1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
4 @brief Main entry point for the application
8 # include "../config.h"
9 #endif // HAVE_CONFIG_H
14 #endif // HAVE_LOCALE_H
18 #endif // HAVE_STDIO_H
21 # include <sys/types.h>
23 #endif // HAVE_UNISTD_H
29 #include "otk/util.hh"
31 int main(int argc, char **argv) {
32 // initialize the locale
33 if (!setlocale(LC_ALL, ""))
34 printf("Couldn't set locale from environment.\n");
35 bindtextdomain(PACKAGE, LOCALEDIR);
36 bind_textdomain_codeset(PACKAGE, "UTF-8");
39 ob::Openbox *openbox = new ob::Openbox(argc, argv);
42 if (openbox->doRestart()) {
43 std::string prog = openbox->restartProgram();
45 delete openbox; // shutdown the current one!
48 execl("/bin/sh", "/bin/sh", "-c", prog.c_str(), NULL);
52 // fall back in case the above execlp doesn't work
53 execvp(argv[0], argv);
54 execvp(otk::basename(argv[0]).c_str(), argv);
57 delete openbox; // shutdown