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
34 #include "blackbox.hh"
37 static void showHelp(int exitval) {
38 // print program usage and command line options
39 printf("Openbox %s : (c) 2002 - 2002 Ben Jansens\n"
40 " -display <string>\t\tuse display connection.\n"
41 " -rc <string>\t\t\tuse alternate resource file.\n"
42 " -menu <string>\t\tuse alternate menu file.\n"
43 " -version\t\t\tdisplay version and exit.\n"
44 " -help\t\t\t\tdisplay this help text and exit.\n\n",
47 // some people have requested that we print out compile options
49 printf("Compile time options:\n"
50 " Debugging:\t\t\t%s\n"
53 " Xinerama:\t\t\t%s\n"
54 " 8bpp Ordered Dithering:\t%s\n\n",
81 #else // !ORDEREDPSEUDO
83 #endif // ORDEREDPSEUDO
89 int main(int argc, char **argv) {
90 char *session_display = (char *) 0;
91 char *rc_file = (char *) 0;
92 char *menu_file = (char *) 0;
94 for (int i = 1; i < argc; ++i) {
95 if (! strcmp(argv[i], "-rc")) {
96 // look for alternative rc file to use
99 fprintf(stderr, "error: '-rc' requires and argument\n");
105 } else if (! strcmp(argv[i], "-menu")) {
106 // look for alternative menu file to use
109 fprintf(stderr, "error: '-menu' requires and argument\n");
115 } else if (! strcmp(argv[i], "-display")) {
116 // check for -display option... to run on a display other than the one
117 // set by the environment variable DISPLAY
120 fprintf(stderr, "error: '-display' requires an argument\n");
125 session_display = argv[i];
126 string dtmp = "DISPLAY=";
127 dtmp += session_display;
129 if (putenv(const_cast<char*>(dtmp.c_str()))) {
131 "warning: couldn't set environment variable 'DISPLAY'\n");
134 } else if (! strcmp(argv[i], "-version")) {
135 // print current version string
136 printf("Openbox %s : (c) 2002 - 2002 Ben Jansens\n",
140 } else if (! strcmp(argv[i], "-help")) {
142 } else { // invalid command line option
148 _chdir2(getenv("X11ROOT"));
151 Blackbox blackbox(argv, session_display, rc_file);
152 blackbox.eventLoop();