2 f4ade537 2001-12-11 alex * ngIRCd -- The Next Generation IRC Daemon
3 03d971d9 2002-01-02 alex * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
5 f4ade537 2001-12-11 alex * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
6 f4ade537 2001-12-11 alex * der GNU General Public License (GPL), wie von der Free Software Foundation
7 f4ade537 2001-12-11 alex * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
8 f4ade537 2001-12-11 alex * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
9 f4ade537 2001-12-11 alex * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
10 804b1ec4 2001-12-31 alex * der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
12 1c0ded41 2002-11-18 alex * $Id: ngircd.c,v 1.59 2002/11/18 18:49:34 alex Exp $
14 f4ade537 2001-12-11 alex * ngircd.c: Hier beginnt alles ;-)
18 ca33cbda 2002-03-12 alex #include "portab.h"
20 ca33cbda 2002-03-12 alex #include "imp.h"
21 f4ade537 2001-12-11 alex #include <assert.h>
22 22cf0c5d 2002-01-12 alex #include <errno.h>
23 f4ade537 2001-12-11 alex #include <stdio.h>
24 75c0bd25 2002-04-04 alex #include <stdlib.h>
25 418add93 2001-12-12 alex #include <signal.h>
26 52424b49 2002-01-11 alex #include <string.h>
27 22cf0c5d 2002-01-12 alex #include <unistd.h>
28 03d971d9 2002-01-02 alex #include <sys/types.h>
29 9ec32d15 2002-06-02 alex #include <sys/stat.h>
30 03d971d9 2002-01-02 alex #include <sys/wait.h>
31 ac9da09e 2001-12-30 alex #include <time.h>
32 70c9c051 2002-11-10 alex #include <pwd.h>
33 70c9c051 2002-11-10 alex #include <grp.h>
35 ba258e65 2002-05-27 alex #include "resolve.h"
36 ba258e65 2002-05-27 alex #include "conn.h"
37 58c6c8f3 2001-12-14 alex #include "client.h"
38 ba258e65 2002-05-27 alex #include "channel.h"
39 418add93 2001-12-12 alex #include "conf.h"
40 25f32ce8 2002-10-07 alex #include "cvs-version.h"
41 ca33cbda 2002-03-12 alex #include "defines.h"
42 ba258e65 2002-05-27 alex #include "lists.h"
43 f4ade537 2001-12-11 alex #include "log.h"
44 1751c869 2001-12-21 alex #include "parse.h"
45 ba258e65 2002-05-27 alex #include "irc.h"
47 ca33cbda 2002-03-12 alex #include "exp.h"
48 f4ade537 2001-12-11 alex #include "ngircd.h"
51 ba258e65 2002-05-27 alex LOCAL VOID Initialize_Signal_Handler PARAMS(( VOID ));
52 ba258e65 2002-05-27 alex LOCAL VOID Signal_Handler PARAMS(( INT Signal ));
54 ba258e65 2002-05-27 alex LOCAL VOID Initialize_Listen_Ports PARAMS(( VOID ));
56 ba258e65 2002-05-27 alex LOCAL VOID Show_Version PARAMS(( VOID ));
57 ba258e65 2002-05-27 alex LOCAL VOID Show_Help PARAMS(( VOID ));
61 ba258e65 2002-05-27 alex main( int argc, const char *argv[] )
63 70c9c051 2002-11-10 alex struct passwd *pwd;
64 70c9c051 2002-11-10 alex struct group *grp;
65 a89dc546 2002-03-27 alex BOOLEAN ok, configtest = FALSE;
66 c7b55aa6 2002-10-09 alex LONG pid, n;
69 9ec32d15 2002-06-02 alex umask( 0077 );
71 52424b49 2002-01-11 alex NGIRCd_Restart = FALSE;
72 52424b49 2002-01-11 alex NGIRCd_Quit = FALSE;
73 52424b49 2002-01-11 alex NGIRCd_NoDaemon = FALSE;
74 eea1a88b 2002-02-19 alex NGIRCd_Passive = FALSE;
75 52424b49 2002-01-11 alex #ifdef DEBUG
76 52424b49 2002-01-11 alex NGIRCd_Debug = FALSE;
78 d79a7d28 2002-01-18 alex #ifdef SNIFFER
79 d79a7d28 2002-01-18 alex NGIRCd_Sniffer = FALSE;
81 a89dc546 2002-03-27 alex strcpy( NGIRCd_ConfFile, CONFIG_FILE );
83 52424b49 2002-01-11 alex /* Kommandozeile parsen */
84 52424b49 2002-01-11 alex for( i = 1; i < argc; i++ )
87 52424b49 2002-01-11 alex if(( argv[i][0] == '-' ) && ( argv[i][1] == '-' ))
89 52424b49 2002-01-11 alex /* Lange Option */
91 72accd4e 2002-03-28 alex if( strcmp( argv[i], "--config" ) == 0 )
93 72accd4e 2002-03-28 alex if( i + 1 < argc )
95 72accd4e 2002-03-28 alex /* Ok, danach kommt noch ein Parameter */
96 72accd4e 2002-03-28 alex strncpy( NGIRCd_ConfFile, argv[i + 1], FNAME_LEN - 1 );
97 72accd4e 2002-03-28 alex NGIRCd_ConfFile[FNAME_LEN - 1] = '\0';
99 72accd4e 2002-03-28 alex /* zum uebernaechsten Parameter */
100 72accd4e 2002-03-28 alex i++; ok = TRUE;
103 a89dc546 2002-03-27 alex if( strcmp( argv[i], "--configtest" ) == 0 )
105 a89dc546 2002-03-27 alex configtest = TRUE;
108 eea1a88b 2002-02-19 alex #ifdef DEBUG
109 eea1a88b 2002-02-19 alex if( strcmp( argv[i], "--debug" ) == 0 )
111 eea1a88b 2002-02-19 alex NGIRCd_Debug = TRUE;
115 52424b49 2002-01-11 alex if( strcmp( argv[i], "--help" ) == 0 )
117 a89dc546 2002-03-27 alex Show_Version( );
118 a89dc546 2002-03-27 alex puts( "" ); Show_Help( ); puts( "" );
121 eea1a88b 2002-02-19 alex if( strcmp( argv[i], "--nodaemon" ) == 0 )
123 eea1a88b 2002-02-19 alex NGIRCd_NoDaemon = TRUE;
126 eea1a88b 2002-02-19 alex if( strcmp( argv[i], "--passive" ) == 0 )
128 eea1a88b 2002-02-19 alex NGIRCd_Passive = TRUE;
131 d79a7d28 2002-01-18 alex #ifdef SNIFFER
132 d79a7d28 2002-01-18 alex if( strcmp( argv[i], "--sniffer" ) == 0 )
134 d79a7d28 2002-01-18 alex NGIRCd_Sniffer = TRUE;
138 eea1a88b 2002-02-19 alex if( strcmp( argv[i], "--version" ) == 0 )
140 d67d94ea 2002-03-10 alex Show_Version( );
144 52424b49 2002-01-11 alex else if(( argv[i][0] == '-' ) && ( argv[i][1] != '-' ))
146 52424b49 2002-01-11 alex /* Kurze Option */
148 c7b55aa6 2002-10-09 alex for( n = 1; n < (LONG)strlen( argv[i] ); n++ )
150 52424b49 2002-01-11 alex ok = FALSE;
151 52424b49 2002-01-11 alex #ifdef DEBUG
152 52424b49 2002-01-11 alex if( argv[i][n] == 'd' )
154 52424b49 2002-01-11 alex NGIRCd_Debug = TRUE;
158 72accd4e 2002-03-28 alex if( argv[i][n] == 'f' )
160 85aad869 2002-03-31 alex if(( ! argv[i][n + 1] ) && ( i + 1 < argc ))
162 72accd4e 2002-03-28 alex /* Ok, danach kommt ein Leerzeichen */
163 72accd4e 2002-03-28 alex strncpy( NGIRCd_ConfFile, argv[i + 1], FNAME_LEN - 1 );
164 72accd4e 2002-03-28 alex NGIRCd_ConfFile[FNAME_LEN - 1] = '\0';
166 72accd4e 2002-03-28 alex /* zum uebernaechsten Parameter */
167 c7b55aa6 2002-10-09 alex i++; n = (LONG)strlen( argv[i] );
171 eea1a88b 2002-02-19 alex if( argv[i][n] == 'n' )
173 eea1a88b 2002-02-19 alex NGIRCd_NoDaemon = TRUE;
176 eea1a88b 2002-02-19 alex if( argv[i][n] == 'p' )
178 eea1a88b 2002-02-19 alex NGIRCd_Passive = TRUE;
181 d79a7d28 2002-01-18 alex #ifdef SNIFFER
182 d79a7d28 2002-01-18 alex if( argv[i][n] == 's' )
184 d79a7d28 2002-01-18 alex NGIRCd_Sniffer = TRUE;
191 ba258e65 2002-05-27 alex printf( "%s: invalid option \"-%c\"!\n", PACKAGE, argv[i][n] );
192 ba258e65 2002-05-27 alex printf( "Try \"%s --help\" for more information.\n", PACKAGE );
200 ba258e65 2002-05-27 alex printf( "%s: invalid option \"%s\"!\n", PACKAGE, argv[i] );
201 ba258e65 2002-05-27 alex printf( "Try \"%s --help\" for more information.\n", PACKAGE );
206 eea1a88b 2002-02-19 alex /* Debug-Level (fuer IRC-Befehl "VERSION") ermitteln */
207 eea1a88b 2002-02-19 alex strcpy( NGIRCd_DebugLevel, "" );
208 eea1a88b 2002-02-19 alex #ifdef DEBUG
209 eea1a88b 2002-02-19 alex if( NGIRCd_Debug ) strcpy( NGIRCd_DebugLevel, "1" );
211 eea1a88b 2002-02-19 alex #ifdef SNIFFER
212 991da8ea 2002-05-18 alex if( NGIRCd_Sniffer )
214 991da8ea 2002-05-18 alex NGIRCd_Debug = TRUE;
215 991da8ea 2002-05-18 alex strcpy( NGIRCd_DebugLevel, "2" );
219 a89dc546 2002-03-27 alex /* Soll nur die Konfigurations ueberprueft und ausgegeben werden? */
220 a89dc546 2002-03-27 alex if( configtest )
222 a89dc546 2002-03-27 alex Show_Version( ); puts( "" );
223 a89dc546 2002-03-27 alex exit( Conf_Test( ));
226 804b1ec4 2001-12-31 alex while( ! NGIRCd_Quit )
228 22cf0c5d 2002-01-12 alex /* In der Regel wird ein Sub-Prozess ge-fork()'t, der
229 22cf0c5d 2002-01-12 alex * nicht mehr mit dem Terminal verbunden ist. Mit der
230 22cf0c5d 2002-01-12 alex * Option "--nodaemon" kann dies (z.B. zum Debuggen)
231 22cf0c5d 2002-01-12 alex * verhindert werden. */
232 22cf0c5d 2002-01-12 alex if( ! NGIRCd_NoDaemon )
234 22cf0c5d 2002-01-12 alex /* Daemon im Hintergrund erzeugen */
235 c7b55aa6 2002-10-09 alex pid = (LONG)fork( );
236 22cf0c5d 2002-01-12 alex if( pid > 0 )
238 22cf0c5d 2002-01-12 alex /* "alter" Prozess */
241 22cf0c5d 2002-01-12 alex if( pid < 0 )
243 22cf0c5d 2002-01-12 alex /* Fehler */
244 ba258e65 2002-05-27 alex printf( "%s: Can't fork: %s!\nFatal error, exiting now ...\n", PACKAGE, strerror( errno ));
248 fe2bc90e 2002-03-06 alex /* Child-Prozess initialisieren */
249 95a4b1b1 2002-03-25 alex (VOID)setsid( );
250 22cf0c5d 2002-01-12 alex chdir( "/" );
253 804b1ec4 2001-12-31 alex /* Globale Variablen initialisieren */
254 804b1ec4 2001-12-31 alex NGIRCd_Start = time( NULL );
255 95a4b1b1 2002-03-25 alex (VOID)strftime( NGIRCd_StartStr, 64, "%a %b %d %Y at %H:%M:%S (%Z)", localtime( &NGIRCd_Start ));
256 804b1ec4 2001-12-31 alex NGIRCd_Restart = FALSE;
257 804b1ec4 2001-12-31 alex NGIRCd_Quit = FALSE;
259 804b1ec4 2001-12-31 alex /* Module initialisieren */
260 804b1ec4 2001-12-31 alex Log_Init( );
261 ba258e65 2002-05-27 alex Resolve_Init( );
262 804b1ec4 2001-12-31 alex Conf_Init( );
263 ba258e65 2002-05-27 alex Lists_Init( );
264 804b1ec4 2001-12-31 alex Channel_Init( );
265 804b1ec4 2001-12-31 alex Client_Init( );
266 804b1ec4 2001-12-31 alex Conn_Init( );
268 07c3e62e 2002-03-29 alex /* Wenn als root ausgefuehrt und eine andere UID
269 07c3e62e 2002-03-29 alex * konfiguriert ist, jetzt zu dieser wechseln */
270 fe06f6e9 2002-03-29 alex if( getuid( ) == 0 )
272 fe06f6e9 2002-03-29 alex if( Conf_GID != 0 )
274 07c3e62e 2002-03-29 alex /* Neue Group-ID setzen */
275 07c3e62e 2002-03-29 alex if( setgid( Conf_GID ) != 0 ) Log( LOG_ERR, "Can't change Group-ID to %u: %s", Conf_GID, strerror( errno ));
277 fe06f6e9 2002-03-29 alex if( Conf_UID != 0 )
279 07c3e62e 2002-03-29 alex /* Neue User-ID setzen */
280 fe06f6e9 2002-03-29 alex if( setuid( Conf_UID ) != 0 ) Log( LOG_ERR, "Can't change User-ID to %u: %s", Conf_UID, strerror( errno ));
284 70c9c051 2002-11-10 alex /* User, Gruppe und Prozess-ID des Daemon ausgeben */
285 70c9c051 2002-11-10 alex pwd = getpwuid( getuid( )); grp = getgrgid( getgid( ));
286 70c9c051 2002-11-10 alex Log( LOG_INFO, "Running as user %s(%ld), group %s(%ld), with PID %ld.", pwd ? pwd->pw_name : "unknown", (LONG)getuid( ), grp ? grp->gr_name : "unknown", (LONG)getgid( ), (LONG)getpid( ));
288 70c9c051 2002-11-10 alex /* stderr in "Error-File" umlenken */
289 fe06f6e9 2002-03-29 alex Log_InitErrorfile( );
291 804b1ec4 2001-12-31 alex /* Signal-Handler initialisieren */
292 804b1ec4 2001-12-31 alex Initialize_Signal_Handler( );
294 c76e6769 2002-09-02 alex /* Protokoll- und Server-Identifikation erzeugen. Die vom ngIRCd
295 c76e6769 2002-09-02 alex * beim PASS-Befehl verwendete Syntax sowie die erweiterten Flags
296 c76e6769 2002-09-02 alex * sind in doc/Protocol.txt beschrieben. */
297 14cbca87 2002-09-07 alex #ifdef IRCPLUS
298 1c668252 2002-09-03 alex sprintf( NGIRCd_ProtoID, "%s%s %s|%s:%s", PROTOVER, PROTOIRCPLUS, PACKAGE, VERSION, IRCPLUSFLAGS );
299 c76e6769 2002-09-02 alex if( Conf_OperCanMode ) strcat( NGIRCd_ProtoID, "o" );
301 14cbca87 2002-09-07 alex sprintf( NGIRCd_ProtoID, "%s%s %s|%s", PROTOVER, PROTOIRC, PACKAGE, VERSION );
303 c76e6769 2002-09-02 alex strcat( NGIRCd_ProtoID, " P" );
304 65b31ffb 2002-09-02 alex Log( LOG_DEBUG, "Protocol and server ID is \"%s\".", NGIRCd_ProtoID );
306 b788a3da 2002-06-02 alex /* Vordefinierte Channels anlegen */
307 b788a3da 2002-06-02 alex Channel_InitPredefined( );
309 804b1ec4 2001-12-31 alex /* Listen-Ports initialisieren */
310 804b1ec4 2001-12-31 alex Initialize_Listen_Ports( );
312 804b1ec4 2001-12-31 alex /* Hauptschleife */
313 9ec32d15 2002-06-02 alex Conn_Handler( );
315 804b1ec4 2001-12-31 alex /* Alles abmelden */
316 804b1ec4 2001-12-31 alex Conn_Exit( );
317 804b1ec4 2001-12-31 alex Client_Exit( );
318 804b1ec4 2001-12-31 alex Channel_Exit( );
319 ba258e65 2002-05-27 alex Lists_Exit( );
320 804b1ec4 2001-12-31 alex Log_Exit( );
324 f4ade537 2001-12-11 alex } /* main */
327 ba258e65 2002-05-27 alex GLOBAL CHAR *
328 ba258e65 2002-05-27 alex NGIRCd_Version( VOID )
330 52424b49 2002-01-11 alex STATIC CHAR version[126];
332 25f32ce8 2002-10-07 alex #ifdef CVSDATE
333 25f32ce8 2002-10-07 alex sprintf( version, "%s %s(%s)-%s", PACKAGE, VERSION, CVSDATE, NGIRCd_VersionAddition( ));
335 14cbca87 2002-09-07 alex sprintf( version, "%s %s-%s", PACKAGE, VERSION, NGIRCd_VersionAddition( ));
337 3fbbfe44 2002-02-17 alex return version;
338 3fbbfe44 2002-02-17 alex } /* NGIRCd_Version */
341 ba258e65 2002-05-27 alex GLOBAL CHAR *
342 ba258e65 2002-05-27 alex NGIRCd_VersionAddition( VOID )
344 3fbbfe44 2002-02-17 alex STATIC CHAR txt[64];
346 52424b49 2002-01-11 alex strcpy( txt, "" );
348 52424b49 2002-01-11 alex #ifdef USE_SYSLOG
349 52424b49 2002-01-11 alex if( txt[0] ) strcat( txt, "+" );
350 52424b49 2002-01-11 alex strcat( txt, "SYSLOG" );
352 52424b49 2002-01-11 alex #ifdef DEBUG
353 52424b49 2002-01-11 alex if( txt[0] ) strcat( txt, "+" );
354 52424b49 2002-01-11 alex strcat( txt, "DEBUG" );
356 52424b49 2002-01-11 alex #ifdef SNIFFER
357 52424b49 2002-01-11 alex if( txt[0] ) strcat( txt, "+" );
358 52424b49 2002-01-11 alex strcat( txt, "SNIFFER" );
360 14cbca87 2002-09-07 alex #ifdef STRICT_RFC
361 14cbca87 2002-09-07 alex if( txt[0] ) strcat( txt, "+" );
362 14cbca87 2002-09-07 alex strcat( txt, "RFC" );
364 14cbca87 2002-09-07 alex #ifdef IRCPLUS
365 14cbca87 2002-09-07 alex if( txt[0] ) strcat( txt, "+" );
366 14cbca87 2002-09-07 alex strcat( txt, "IRCPLUS" );
369 3fbbfe44 2002-02-17 alex if( txt[0] ) strcat( txt, "-" );
370 f7327524 2002-05-30 alex strcat( txt, TARGET_CPU );
371 f7327524 2002-05-30 alex strcat( txt, "/" );
372 f7327524 2002-05-30 alex strcat( txt, TARGET_VENDOR );
373 f7327524 2002-05-30 alex strcat( txt, "/" );
374 f7327524 2002-05-30 alex strcat( txt, TARGET_OS );
376 3fbbfe44 2002-02-17 alex return txt;
377 3fbbfe44 2002-02-17 alex } /* NGIRCd_VersionAddition */
381 ba258e65 2002-05-27 alex Initialize_Signal_Handler( VOID )
383 08cf5607 2001-12-26 alex /* Signal-Handler initialisieren: einige Signale
384 08cf5607 2001-12-26 alex * werden ignoriert, andere speziell behandelt. */
386 62266a8d 2002-02-25 alex #ifdef HAVE_SIGACTION
387 62266a8d 2002-02-25 alex /* sigaction() ist vorhanden */
389 418add93 2001-12-12 alex struct sigaction saction;
391 418add93 2001-12-12 alex /* Signal-Struktur initialisieren */
392 418add93 2001-12-12 alex memset( &saction, 0, sizeof( saction ));
393 23253edb 2002-01-22 alex saction.sa_handler = Signal_Handler;
394 9919f38d 2002-02-19 alex #ifdef SA_RESTART
395 6f955d2a 2002-02-23 alex saction.sa_flags |= SA_RESTART;
397 6f955d2a 2002-02-23 alex #ifdef SA_NOCLDWAIT
398 6f955d2a 2002-02-23 alex saction.sa_flags |= SA_NOCLDWAIT;
401 418add93 2001-12-12 alex /* Signal-Handler einhaengen */
402 418add93 2001-12-12 alex sigaction( SIGINT, &saction, NULL );
403 418add93 2001-12-12 alex sigaction( SIGQUIT, &saction, NULL );
404 418add93 2001-12-12 alex sigaction( SIGTERM, &saction, NULL);
405 3fbbfe44 2002-02-17 alex sigaction( SIGHUP, &saction, NULL);
406 03d971d9 2002-01-02 alex sigaction( SIGCHLD, &saction, NULL);
408 eb952e35 2001-12-24 alex /* einige Signale ignorieren */
409 eb952e35 2001-12-24 alex saction.sa_handler = SIG_IGN;
410 eb952e35 2001-12-24 alex sigaction( SIGPIPE, &saction, NULL );
412 62266a8d 2002-02-25 alex /* kein sigaction() vorhanden */
414 62266a8d 2002-02-25 alex /* Signal-Handler einhaengen */
415 62266a8d 2002-02-25 alex signal( SIGINT, Signal_Handler );
416 62266a8d 2002-02-25 alex signal( SIGQUIT, Signal_Handler );
417 62266a8d 2002-02-25 alex signal( SIGTERM, Signal_Handler );
418 62266a8d 2002-02-25 alex signal( SIGHUP, Signal_Handler );
419 62266a8d 2002-02-25 alex signal( SIGCHLD, Signal_Handler );
421 62266a8d 2002-02-25 alex /* einige Signale ignorieren */
422 62266a8d 2002-02-25 alex signal( SIGPIPE, SIG_IGN );
424 418add93 2001-12-12 alex } /* Initialize_Signal_Handler */
428 ba258e65 2002-05-27 alex Signal_Handler( INT Signal )
430 418add93 2001-12-12 alex /* Signal-Handler. Dieser wird aufgerufen, wenn eines der Signale eintrifft,
431 418add93 2001-12-12 alex * fuer das wir uns registriert haben (vgl. Initialize_Signal_Handler). Die
432 418add93 2001-12-12 alex * Nummer des eingetroffenen Signals wird der Funktion uebergeben. */
434 f4ade537 2001-12-11 alex switch( Signal )
436 f4ade537 2001-12-11 alex case SIGTERM:
437 b61b8c4d 2001-12-12 alex case SIGINT:
438 b61b8c4d 2001-12-12 alex case SIGQUIT:
439 418add93 2001-12-12 alex /* wir soll(t)en uns wohl beenden ... */
440 3fbbfe44 2002-02-17 alex if( Signal == SIGTERM ) Log( LOG_WARNING, "Got TERM signal, terminating now ..." );
441 3fbbfe44 2002-02-17 alex else if( Signal == SIGINT ) Log( LOG_WARNING, "Got INT signal, terminating now ..." );
442 3fbbfe44 2002-02-17 alex else if( Signal == SIGQUIT ) Log( LOG_WARNING, "Got QUIT signal, terminating now ..." );
443 ff280ce4 2001-12-12 alex NGIRCd_Quit = TRUE;
445 3fbbfe44 2002-02-17 alex case SIGHUP:
446 3fbbfe44 2002-02-17 alex /* neu starten */
447 3fbbfe44 2002-02-17 alex Log( LOG_WARNING, "Got HUP signal, restarting now ..." );
448 3fbbfe44 2002-02-17 alex NGIRCd_Restart = TRUE;
450 03d971d9 2002-01-02 alex case SIGCHLD:
451 03d971d9 2002-01-02 alex /* Child-Prozess wurde beendet. Zombies vermeiden: */
452 03d971d9 2002-01-02 alex while( waitpid( -1, NULL, WNOHANG ) > 0);
455 418add93 2001-12-12 alex /* unbekanntes bzw. unbehandeltes Signal */
456 ff280ce4 2001-12-12 alex Log( LOG_NOTICE, "Got signal %d! Ignored.", Signal );
458 f4ade537 2001-12-11 alex } /* Signal_Handler */
462 ba258e65 2002-05-27 alex Initialize_Listen_Ports( VOID )
464 9856253d 2001-12-30 alex /* Ports, auf denen der Server Verbindungen entgegennehmen
465 9856253d 2001-12-30 alex * soll, initialisieren */
467 74ff9828 2002-10-03 alex INT created, i;
469 9856253d 2001-12-30 alex created = 0;
470 9856253d 2001-12-30 alex for( i = 0; i < Conf_ListenPorts_Count; i++ )
472 9856253d 2001-12-30 alex if( Conn_NewListener( Conf_ListenPorts[i] )) created++;
473 07c3e62e 2002-03-29 alex else Log( LOG_ERR, "Can't listen on port %u!", Conf_ListenPorts[i] );
476 9856253d 2001-12-30 alex if( created < 1 )
478 9856253d 2001-12-30 alex Log( LOG_ALERT, "Server isn't listening on a single port!" );
479 ba258e65 2002-05-27 alex Log( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE );
482 9856253d 2001-12-30 alex } /* Initialize_Listen_Ports */
486 ba258e65 2002-05-27 alex Show_Version( VOID )
488 52424b49 2002-01-11 alex puts( NGIRCd_Version( ));
489 5b27e491 2002-04-01 alex puts( "Copyright (c)2001,2002 by Alexander Barton (<alex@barton.de>)." );
490 5b27e491 2002-04-01 alex puts( "Homepage: <http://arthur.ath.cx/~alex/ngircd/>\n" );
491 52424b49 2002-01-11 alex puts( "This is free software; see the source for copying conditions. There is NO" );
492 52424b49 2002-01-11 alex puts( "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." );
493 52424b49 2002-01-11 alex } /* Show_Version */
497 ba258e65 2002-05-27 alex Show_Help( VOID )
499 52424b49 2002-01-11 alex #ifdef DEBUG
500 72accd4e 2002-03-28 alex puts( " -d, --debug log extra debug messages" );
502 72accd4e 2002-03-28 alex puts( " -f, --config <f> use file <f> as configuration file" );
503 1c0ded41 2002-11-18 alex puts( " -n, --nodaemon don't fork and don't detach from controlling terminal" );
504 72accd4e 2002-03-28 alex puts( " -p, --passive disable automatic connections to other servers" );
505 72accd4e 2002-03-28 alex #ifdef SNIFFER
506 72accd4e 2002-03-28 alex puts( " -s, --sniffer enable network sniffer and display all IRC traffic" );
508 72accd4e 2002-03-28 alex puts( " --configtest read, validate and display configuration; then exit" );
509 72accd4e 2002-03-28 alex puts( " --version output version information and exit" );
510 72accd4e 2002-03-28 alex puts( " --help display this help and exit" );
511 52424b49 2002-01-11 alex } /* Show_Help */
514 f4ade537 2001-12-11 alex /* -eof- */