- char *session_display = (char *) 0;
- char *rc_file = (char *) 0;
-
- i18n.openCatalog("blackbox.cat");
-
- for (int i = 1; i < argc; ++i) {
- if (! strcmp(argv[i], "-rc")) {
- // look for alternative rc file to use
-
- if ((++i) >= argc) {
- fprintf(stderr,
- i18n(mainSet, mainRCRequiresArg,
- "error: '-rc' requires and argument\n"));
-
- ::exit(1);
- }
-
- rc_file = argv[i];
- } else if (! strcmp(argv[i], "-display")) {
- // check for -display option... to run on a display other than the one
- // set by the environment variable DISPLAY
-
- if ((++i) >= argc) {
- fprintf(stderr,
- i18n(mainSet, mainDISPLAYRequiresArg,
- "error: '-display' requires an argument\n"));
-
- ::exit(1);
- }
-
- session_display = argv[i];
- string dtmp = "DISPLAY=";
- dtmp += session_display;
-
- if (putenv(const_cast<char*>(dtmp.c_str()))) {
- fprintf(stderr, i18n(mainSet, mainWarnDisplaySet,
- "warning: couldn't set environment variable 'DISPLAY'\n"));
- perror("putenv()");
- }
- } else if (! strcmp(argv[i], "-version")) {
- // print current version string
- printf("Blackbox %s : (c) 2001 - 2002 Sean 'Shaleh' Perry\n",
- "\t\t\t 1997 - 2000 Brad Hughes\n"
- __blackbox_version);
-
- ::exit(0);
- } else if (! strcmp(argv[i], "-help")) {
- showHelp(0);
- } else { // invalid command line option
- showHelp(-1);
- }
- }
-
-#ifdef __EMX__
- _chdir2(getenv("X11ROOT"));
-#endif // __EMX__
-
- Blackbox blackbox(argv, session_display, rc_file);
- blackbox.eventLoop();
-
- return(0);
+ // initialize the locale
+ if (!setlocale(LC_ALL, ""))
+ printf("Couldn't set locale from environment.\n");
+ bindtextdomain(PACKAGE, LOCALEDIR);
+ bind_textdomain_codeset(PACKAGE, "UTF-8");
+ textdomain(PACKAGE);
+
+ ob::Openbox openbox(argc, argv);
+ openbox.eventLoop();