]> arthur.barton.de Git - ngircd.git/blobdiff - src/ngircd/ngircd.c
Merge branch 'katp32/master'
[ngircd.git] / src / ngircd / ngircd.c
index 76ea8d38b7f31d6b1951f9f4d6f4490b208cb8da..fd919e34becff5f6c7a33963e9b5d4e591fd991d 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2022 Alexander Barton (alex@barton.de) and Contributors.
+ * Copyright (c)2001-2023 Alexander Barton (alex@barton.de) and Contributors.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -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();
@@ -341,11 +355,13 @@ Fill_Version(void)
        strlcat(NGIRCd_VersionAddition, "CHARCONV",
                sizeof NGIRCd_VersionAddition);
 #endif
+#ifdef DEBUG
        if (NGIRCd_VersionAddition[0])
                strlcat(NGIRCd_VersionAddition, "+",
                        sizeof NGIRCd_VersionAddition);
        strlcat(NGIRCd_VersionAddition, "DEBUG",
                sizeof NGIRCd_VersionAddition);
+#endif
 #ifdef IDENTAUTH
        if (NGIRCd_VersionAddition[0])
                strlcat(NGIRCd_VersionAddition, "+",
@@ -441,7 +457,7 @@ static void
 Show_Version( void )
 {
        puts( NGIRCd_Version );
-       puts( "Copyright (c)2001-2022 Alexander Barton (<alex@barton.de>) and Contributors." );
+       puts( "Copyright (c)2001-2023 Alexander Barton (<alex@barton.de>) and Contributors." );
        puts( "Homepage: <http://ngircd.barton.de/>\n" );
        puts( "This is free software; see the source for copying conditions. There is NO" );
        puts( "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." );
@@ -465,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 */