]>
Dogcows Code - chaz/openbox/blob - src/main.cc
4ea8aaf10c21715d409ae76479ff3cc0b44e1534
1 // -*- mode: C++; indent-tabs-mode: nil; -*-
3 #include "../version.h"
6 # include "../config.h"
7 #endif // HAVE_CONFIG_H
12 #endif // HAVE_STDIO_H
16 #endif // HAVE_STDLIB_H
20 #endif // HAVE_STRING_H
23 #include <sys/types.h>
24 #endif // HAVE_UNISTD_H
26 #ifdef HAVE_SYS_PARAM_H
27 # include <sys/param.h>
28 #endif // HAVE_SYS_PARAM_H
32 #define _(str) gettext(str)
37 #include "blackbox.hh"
40 static void showHelp(int exitval
) {
41 // print program usage and command line options
42 printf(_("Openbox %s : (c) 2002 - 2002 Ben Jansens\n"),
44 printf(_(" -display <string> use display connection.\n\
45 -rc <string> use alternate resource file.\n\
46 -menu <string> use alternate menu file.\n\
47 -version display version and exit.\n\
48 -help display this help text and exit.\n\n"));
50 // some people have requested that we print out compile options
52 printf(_("Compile time options:\n\
57 8bpp Ordered Dithering:\t%s\n\n"),
84 #else // !ORDEREDPSEUDO
86 #endif // ORDEREDPSEUDO
92 int main(int argc
, char **argv
) {
93 char *session_display
= (char *) 0;
94 char *rc_file
= (char *) 0;
95 char *menu_file
= (char *) 0;
97 for (int i
= 1; i
< argc
; ++i
) {
98 if (! strcmp(argv
[i
], "-rc")) {
99 // look for alternative rc file to use
102 fprintf(stderr
, _("error: '-rc' requires and argument\n"));
108 } else if (! strcmp(argv
[i
], "-menu")) {
109 // look for alternative menu file to use
112 fprintf(stderr
, _("error: '-menu' requires and argument\n"));
118 } else if (! strcmp(argv
[i
], "-display")) {
119 // check for -display option... to run on a display other than the one
120 // set by the environment variable DISPLAY
123 fprintf(stderr
, _("error: '-display' requires an argument\n"));
128 session_display
= argv
[i
];
129 string dtmp
= "DISPLAY=";
130 dtmp
+= session_display
;
132 if (putenv(const_cast<char*>(dtmp
.c_str()))) {
134 _("warning: couldn't set environment variable 'DISPLAY'\n"));
137 } else if (! strcmp(argv
[i
], "-version")) {
138 // print current version string
139 printf(_("Openbox %s : (c) 2002 - 2002 Ben Jansens\n"),
144 } else if (! strcmp(argv
[i
], "-help")) {
146 } else { // invalid command line option
152 _chdir2(getenv("X11ROOT"));
155 Blackbox
blackbox(argv
, session_display
, rc_file
);
156 blackbox
.eventLoop();
This page took 0.03999 seconds and 4 git commands to generate.