X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fngircd%2Fngircd.c;h=47f6092e25748b9e1844655dc0a08b3750768586;hb=3b70f4ba0c5045772290d159e07d65c95c724670;hp=7166640ba054288c08030f331ddf9c9724e0a073;hpb=f5fa7db4ba46521e49a4ae4e1ba9d09c918926b3;p=ngircd-alex.git diff --git a/src/ngircd/ngircd.c b/src/ngircd/ngircd.c index 7166640b..47f6092e 100644 --- a/src/ngircd/ngircd.c +++ b/src/ngircd/ngircd.c @@ -1,6 +1,6 @@ /* * ngIRCd -- The Next Generation IRC Daemon - * Copyright (c)2001-2020 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 @@ -9,6 +9,7 @@ * Please read the file COPYING, README and AUTHORS for more information. */ +#define GLOBAL_INIT #include "portab.h" /** @@ -87,9 +88,7 @@ main(int argc, const char *argv[]) NGIRCd_SignalQuit = NGIRCd_SignalRestart = false; NGIRCd_Passive = false; -#ifdef DEBUG NGIRCd_Debug = false; -#endif #ifdef SNIFFER NGIRCd_Sniffer = false; #endif @@ -116,12 +115,10 @@ main(int argc, const char *argv[]) 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( "" ); @@ -150,12 +147,10 @@ main(int argc, const char *argv[]) /* 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 */ @@ -222,10 +217,8 @@ main(int argc, const char *argv[]) /* 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; @@ -450,7 +443,7 @@ static void Show_Version( void ) { puts( NGIRCd_Version ); - puts( "Copyright (c)2001-2020 Alexander Barton () and Contributors." ); + puts( "Copyright (c)2001-2023 Alexander Barton () and Contributors." ); puts( "Homepage: \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,9 +458,7 @@ Show_Version( void ) static void Show_Help( void ) { -#ifdef DEBUG puts( " -d, --debug log extra debug messages" ); -#endif puts( " -f, --config use file 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" ); @@ -489,9 +480,7 @@ Pidfile_Delete( void ) /* Pidfile configured? */ if( ! Conf_PidFile[0] ) return; -#ifdef DEBUG - Log( LOG_DEBUG, "Removing PID file (%s) ...", Conf_PidFile ); -#endif + LogDebug( "Removing PID file (%s) ...", Conf_PidFile ); if( unlink( Conf_PidFile )) Log( LOG_ERR, "Error unlinking PID file (%s): %s", Conf_PidFile, strerror( errno )); @@ -513,9 +502,7 @@ Pidfile_Create(pid_t pid) /* Pidfile configured? */ if( ! Conf_PidFile[0] ) return; -#ifdef DEBUG - Log( LOG_DEBUG, "Creating PID file (%s) ...", Conf_PidFile ); -#endif + LogDebug( "Creating PID file (%s) ...", Conf_PidFile ); pidfd = open( Conf_PidFile, O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH); if ( pidfd < 0 ) { @@ -816,7 +803,7 @@ NGIRCd_Init(bool NGIRCd_NoDaemon) if (pwd) { if (chdir(pwd->pw_dir) == 0) - Log(LOG_DEBUG, + LogDebug( "Changed working directory to \"%s\" ...", pwd->pw_dir); else