/*
* ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2022 Alexander Barton (alex@barton.de) and Contributors.
+ * Copyright (c)2001-2024 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
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;
NGIRCd_SignalQuit = NGIRCd_SignalRestart = false;
NGIRCd_Passive = false;
-#ifdef DEBUG
NGIRCd_Debug = false;
-#endif
#ifdef SNIFFER
NGIRCd_Sniffer = false;
#endif
configtest = true;
ok = true;
}
-#ifdef DEBUG
if (strcmp(argv[i], "--debug") == 0) {
NGIRCd_Debug = true;
ok = true;
}
-#endif
if (strcmp(argv[i], "--help") == 0) {
Show_Version();
puts(""); Show_Help( ); puts( "" );
}
if (strcmp(argv[i], "--nodaemon") == 0) {
NGIRCd_NoDaemon = true;
+ NGIRCd_NoSyslog = true;
ok = true;
}
if (strcmp(argv[i], "--passive") == 0) {
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();
/* short option */
for (n = 1; n < strlen(argv[i]); n++) {
ok = false;
-#ifdef DEBUG
if (argv[i][n] == 'd') {
NGIRCd_Debug = true;
ok = true;
}
-#endif
if (argv[i][n] == 'f') {
if (!argv[i][n+1] && i+1 < argc) {
/* Ok, next character is a blank */
if (argv[i][n] == 'n') {
NGIRCd_NoDaemon = true;
+ NGIRCd_NoSyslog = true;
ok = true;
}
if (argv[i][n] == 'p') {
Show_Version();
exit(1);
}
+#ifdef SYSLOG
+ if (argv[i][n] == 'y') {
+ NGIRCd_NoSyslog = false;
+ ok = true;
+ }
+#endif
if (!ok) {
fprintf(stderr,
/* Debug level for "VERSION" command */
NGIRCd_DebugLevel[0] = '\0';
-#ifdef DEBUG
if (NGIRCd_Debug)
strcpy(NGIRCd_DebugLevel, "1");
-#endif
#ifdef SNIFFER
if (NGIRCd_Sniffer) {
NGIRCd_Debug = true;
NGIRCd_SignalRestart = false;
NGIRCd_SignalQuit = false;
- Log_Init(!NGIRCd_NoDaemon);
+ Log_Init(!NGIRCd_NoSyslog);
Random_Init();
Conf_Init();
Log_ReInit();
Show_Version( void )
{
puts( NGIRCd_Version );
- puts( "Copyright (c)2001-2022 Alexander Barton (<alex@barton.de>) and Contributors." );
+ puts( "Copyright (c)2001-2024 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." );
static void
Show_Help( void )
{
-#ifdef DEBUG
puts( " -d, --debug log extra debug messages" );
-#endif
puts( " -f, --config <f> use file <f> as configuration file" );
puts( " -n, --nodaemon don't fork and don't detach from controlling terminal" );
puts( " -p, --passive disable automatic connections to other servers" );
#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 */