1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
4 @brief Main entry point for the application
11 # include <sys/types.h>
13 #endif // HAVE_UNISTD_H
19 #include "otk/util.hh"
24 int main(int argc, char **argv) {
25 // initialize the locale
26 if (!setlocale(LC_ALL, ""))
27 printf("Couldn't set locale from environment.\n");
28 bindtextdomain(PACKAGE, LOCALEDIR);
29 bind_textdomain_codeset(PACKAGE, "UTF-8");
32 ob::Openbox *openbox = new ob::Openbox(argc, argv);
35 if (openbox->doRestart()) {
36 std::string prog = openbox->restartProgram();
38 delete openbox; // shutdown the current one!
41 execl("/bin/sh", "/bin/sh", "-c", prog.c_str(), NULL);
45 // fall back in case the above execlp doesn't work
46 execvp(argv[0], argv);
47 execvp(otk::basename(argv[0]).c_str(), argv);
50 delete openbox; // shutdown