]>
Dogcows Code - chaz/openbox/blob - src/main.cc
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 // initialize the locale
98 setlocale(LC_ALL
, "");
99 bindtextdomain(PACKAGE
, LOCALEDIR
);
102 for (int i
= 1; i
< argc
; ++i
) {
103 if (! strcmp(argv
[i
], "-rc")) {
104 // look for alternative rc file to use
107 fprintf(stderr
, _("error: '-rc' requires and argument\n"));
113 } else if (! strcmp(argv
[i
], "-menu")) {
114 // look for alternative menu file to use
117 fprintf(stderr
, _("error: '-menu' requires and argument\n"));
123 } else if (! strcmp(argv
[i
], "-display")) {
124 // check for -display option... to run on a display other than the one
125 // set by the environment variable DISPLAY
128 fprintf(stderr
, _("error: '-display' requires an argument\n"));
133 session_display
= argv
[i
];
134 string dtmp
= "DISPLAY=";
135 dtmp
+= session_display
;
137 if (putenv(const_cast<char*>(dtmp
.c_str()))) {
139 _("warning: couldn't set environment variable 'DISPLAY'\n"));
142 } else if (! strcmp(argv
[i
], "-version")) {
143 // print current version string
144 printf(_("Openbox %s : (c) 2002 - 2002 Ben Jansens\n"),
149 } else if (! strcmp(argv
[i
], "-help")) {
151 } else { // invalid command line option
157 _chdir2(getenv("X11ROOT"));
160 Blackbox
blackbox(argv
, session_display
, rc_file
);
161 blackbox
.eventLoop();
This page took 0.040693 seconds and 4 git commands to generate.