]> arthur.barton.de Git - ngircd.git/blobdiff - src/ngircd/ngircd.c
Merge branch 'katp32/master'
[ngircd.git] / src / ngircd / ngircd.c
index 47f6092e25748b9e1844655dc0a08b3750768586..fd919e34becff5f6c7a33963e9b5d4e591fd991d 100644 (file)
@@ -74,7 +74,7 @@ GLOBAL int
 main(int argc, const char *argv[])
 {
        bool ok, configtest = false;
-       bool NGIRCd_NoDaemon = false;
+       bool NGIRCd_NoDaemon = false, NGIRCd_NoSyslog = false;
        int i;
        size_t n;
 
@@ -126,6 +126,7 @@ main(int argc, const char *argv[])
                        }
                        if (strcmp(argv[i], "--nodaemon") == 0) {
                                NGIRCd_NoDaemon = true;
+                               NGIRCd_NoSyslog = true;
                                ok = true;
                        }
                        if (strcmp(argv[i], "--passive") == 0) {
@@ -137,6 +138,12 @@ main(int argc, const char *argv[])
                                NGIRCd_Sniffer = true;
                                ok = true;
                        }
+#endif
+#ifdef SYSLOG
+                       if (strcmp(argv[i], "--syslog") == 0) {
+                               NGIRCd_NoSyslog = false;
+                               ok = true;
+                       }
 #endif
                        if (strcmp(argv[i], "--version") == 0) {
                                Show_Version();
@@ -172,6 +179,7 @@ main(int argc, const char *argv[])
 
                                if (argv[i][n] == 'n') {
                                        NGIRCd_NoDaemon = true;
+                                       NGIRCd_NoSyslog = true;
                                        ok = true;
                                }
                                if (argv[i][n] == 'p') {
@@ -193,6 +201,12 @@ main(int argc, const char *argv[])
                                        Show_Version();
                                        exit(1);
                                }
+#ifdef SYSLOG
+                               if (argv[i][n] == 'y') {
+                                       NGIRCd_NoSyslog = false;
+                                       ok = true;
+                               }
+#endif
 
                                if (!ok) {
                                        fprintf(stderr,
@@ -241,7 +255,7 @@ main(int argc, const char *argv[])
                NGIRCd_SignalRestart = false;
                NGIRCd_SignalQuit = false;
 
-               Log_Init(!NGIRCd_NoDaemon);
+               Log_Init(!NGIRCd_NoSyslog);
                Random_Init();
                Conf_Init();
                Log_ReInit();
@@ -467,6 +481,9 @@ Show_Help( void )
 #endif
        puts( "  -t, --configtest   read, validate and display configuration; then exit" );
        puts( "  -V, --version      output version information and exit" );
+#ifdef SYSLOG
+       puts( "  -y, --syslog       log to syslog even when running in the foreground (-n)" );
+#endif
        puts( "  -h, --help         display this help and exit" );
 } /* Show_Help */