]>
Dogcows Code - chaz/openbox/blob - src/main.cc
0a0ad5baf84720e96bde1e0f6a5b7bfc8fcd7372
2 // Copyright (c) 2001 Sean 'Shaleh' Perry <shaleh@debian.org>
3 // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net)
5 // Permission is hereby granted, free of charge, to any person obtaining a
6 // copy of this software and associated documentation files (the "Software"),
7 // to deal in the Software without restriction, including without limitation
8 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 // and/or sell copies of the Software, and to permit persons to whom the
10 // Software is furnished to do so, subject to the following conditions:
12 // The above copyright notice and this permission notice shall be included in
13 // all copies or substantial portions of the Software.
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 // DEALINGS IN THE SOFTWARE.
23 // stupid macros needed to access some functions in version 2 of the GNU C
29 #include "../version.h"
32 # include "../config.h"
33 #endif // HAVE_CONFIG_H
40 #endif // HAVE_STDIO_H
45 #endif // STDC_HEADERS
48 #include <sys/types.h>
49 #endif // HAVE_UNISTD_H
51 #ifdef HAVE_SYS_PARAM_H
52 # include <sys/param.h>
53 #endif // HAVE_SYS_PARAM_H
56 #define MAXPATHLEN 255
60 static void showHelp(int exitval
) {
61 // print program usage and command line options
62 printf(i18n
->getMessage(mainSet
, mainUsage
,
63 "Openbox %s : (c) 2002 - 2002 Ben Jansens\n"
64 "\t\t\t 2001 - 2002 Sean 'Shaleh' Perry\n\n"
65 "\t\t\t 1997 - 2000 Brad Hughes\n\n"
66 " -display <string>\t\tuse display connection.\n"
67 " -rc <string>\t\t\tuse alternate resource file.\n"
68 " -version\t\t\tdisplay version and exit.\n"
69 " -help\t\t\t\tdisplay this help text and exit.\n\n"),
72 // some people have requested that we print out compile options
74 fprintf(stdout
,i18n
->getMessage(mainSet
, mainCompileOptions
,
75 "Compile time options:\n"
76 " Debugging:\t\t\t%s\n"
77 " Interlacing:\t\t\t%s\n"
80 " 8bpp Ordered Dithering:\t%s\n"
81 " Event Clobbering:\t\t%s\n\n"),
83 i18n
->getMessage(CommonSet
, CommonYes
, "yes"),
85 i18n
->getMessage(CommonSet
, CommonNo
, "no"),
89 i18n
->getMessage(CommonSet
, CommonYes
, "yes"),
91 i18n
->getMessage(CommonSet
, CommonNo
, "no"),
95 i18n
->getMessage(CommonSet
, CommonYes
, "yes"),
97 i18n
->getMessage(CommonSet
, CommonNo
, "no"),
101 i18n
->getMessage(CommonSet
, CommonYes
, "yes"),
103 i18n
->getMessage(CommonSet
, CommonNo
, "no"),
107 i18n
->getMessage(CommonSet
, CommonYes
, "yes"),
108 #else // !ORDEREDPSEUDO
109 i18n
->getMessage(CommonSet
, CommonNo
, "no"),
110 #endif // ORDEREDPSEUDO
113 i18n
->getMessage(CommonSet
, CommonYes
, "yes")
115 i18n
->getMessage(CommonSet
, CommonNo
, "no")
122 int main(int argc
, char **argv
) {
123 char *session_display
= (char *) 0;
124 char *rc_file
= (char *) 0;
126 NLSInit("openbox.cat");
128 for (int i
= 1; i
< argc
; ++i
) {
129 if (! strcmp(argv
[i
], "-rc")) {
130 // look for alternative rc file to use
134 i18n
->getMessage(mainSet
, mainRCRequiresArg
,
135 "error: '-rc' requires and argument\n"));
141 } else if (! strcmp(argv
[i
], "-display")) {
142 // check for -display option... to run on a display other than the one
143 // set by the environment variable DISPLAY
147 i18n
->getMessage(mainSet
, mainDISPLAYRequiresArg
,
148 "error: '-display' requires an argument\n"));
153 session_display
= argv
[i
];
154 char dtmp
[MAXPATHLEN
];
155 sprintf(dtmp
, "DISPLAY=%s", session_display
);
160 getMessage(mainSet
, mainWarnDisplaySet
,
161 "warning: couldn't set environment variable 'DISPLAY'\n"));
164 } else if (! strcmp(argv
[i
], "-version")) {
165 // print current version string
166 printf("Openbox %s : (c) 1997 - 2000 Brad Hughes\n"
167 "\t\t\t 2001 - 2002 Sean 'Shaleh' Perry\n",
171 } else if (! strcmp(argv
[i
], "-help")) {
173 } else { // invalid command line option
179 _chdir2(getenv("X11ROOT"));
182 Openbox
openbox(argc
, argv
, session_display
, rc_file
);
This page took 0.043945 seconds and 4 git commands to generate.