Browse Source

added -nodaemon commandline option

git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/slim/trunk@156 7c53e7cc-98ea-0310-8f1f-a0b24da60408
sip 15 years ago
parent
commit
d97b79fdaa
3 changed files with 12 additions and 4 deletions
  1. 9 2
      app.cpp
  2. 1 0
      app.h
  3. 2 2
      slim.conf

+ 9 - 2
app.cpp

@@ -136,11 +136,13 @@ App::App(int argc, char** argv){
     testing = false;
     mcookie = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
     daemonmode = false;
+    force_nodaemon = false;
     firstlogin = true;
     Dpy = NULL;
 
     // Parse command line
-    while((tmp = getopt(argc, argv, "vhp:d?")) != EOF) {
+    // Note: we force a option for nodaemon switch to handle "-nodaemon"
+    while((tmp = getopt(argc, argv, "vhp:n:d?")) != EOF) {
         switch (tmp) {
         case 'p':    // Test theme
             testtheme = optarg;
@@ -153,6 +155,10 @@ App::App(int argc, char** argv){
         case 'd':    // Daemon mode
             daemonmode = true;
             break;
+        case 'n':    // Daemon mode
+            daemonmode = false;
+            force_nodaemon = true;
+            break;
         case 'v':    // Version
             std::cout << APPNAME << " version " << VERSION << endl;
             exit(OK_EXIT);
@@ -163,6 +169,7 @@ App::App(int argc, char** argv){
             cerr << "usage:  " << APPNAME << " [option ...]" << endl
             << "options:" << endl
             << "    -d: daemon mode" << endl
+            << "    -nodaemon: no-daemon mode" << endl
             << "    -v: show version" << endl
             << "    -p /path/to/theme/dir: preview theme" << endl;
             exit(OK_EXIT);
@@ -263,7 +270,7 @@ void App::Run() {
 #ifndef XNEST_DEBUG
         OpenLog();
         
-        if (cfg->getOption("daemon") == "yes") {
+        if (!force_nodaemon && cfg->getOption("daemon") == "yes") {
             daemonmode = true;
         }
 

+ 1 - 0
app.h

@@ -94,6 +94,7 @@ private:
 
     bool firstlogin;
     bool daemonmode;
+    bool force_nodaemon;
 	// For testing themes
 	char* testtheme;
     bool testing;

+ 2 - 2
slim.conf

@@ -43,8 +43,8 @@ login_cmd           exec /bin/bash -login ~/.xinitrc %session
 # sessionstop_cmd	some command
 
 # Start in daemon mode. Valid values: yes | no
-# Note that this can overridden by the command line
-# option "-d"
+# Note that this can be overriden by the command line
+# options "-d" and "-nodaemon"
 # daemon	yes
 
 # Available sessions (first one is the default).