repo: ngircd action: commit revision: path_from: revision_from: d67d94ea04990be49b3d56b1540746c0785faf1b: path_to: revision_to:
commit d67d94ea04990be49b3d56b1540746c0785faf1b Author: Alexander BartonDate: Sun Mar 10 17:50:48 2002 +0000 - Handling von "--version" und "--help" nochmal geaendert ... diff --git a/MacOSX/ngircd.pbproj/project.pbxproj b/MacOSX/ngircd.pbproj/project.pbxproj
--- a/MacOSX/ngircd.pbproj/project.pbxproj +++ b/MacOSX/ngircd.pbproj/project.pbxproj @@ -94,7 +94,7 @@ HEADER_SEARCH_PATHS = ""; INSTALL_PATH = "$(HOME)/bin"; LIBRARY_SEARCH_PATHS = ""; - OTHER_CFLAGS = ""; + OTHER_CFLAGS = "-DLOCALSTATEDIR=\\\\\\\"/usr/local/var\\\\\\\" -DSYSCONFDIR=\\\\\\\"/usr/local/etc\\\\\\\""; OTHER_LDFLAGS = ""; OTHER_REZFLAGS = ""; PRODUCT_NAME = ngircd; diff --git a/src/ngircd/conf.c b/src/ngircd/conf.c
--- a/src/ngircd/conf.c
+++ b/src/ngircd/conf.c
@@ -9,11 +9,14 @@
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
*
- * $Id: conf.c,v 1.15 2002/03/06 15:35:19 alex Exp $
+ * $Id: conf.c,v 1.16 2002/03/10 17:50:48 alex Exp $
*
* conf.h: Konfiguration des ngircd
*
* $Log: conf.c,v $
+ * Revision 1.16 2002/03/10 17:50:48 alex
+ * - Handling von "--version" und "--help" nochmal geaendert ...
+ *
* Revision 1.15 2002/03/06 15:35:19 alex
* - Dateinamen und Pfad sind nun in Konstanten definiert.
*
@@ -180,6 +183,7 @@ LOCAL VOID Read_Config( VOID )
strcpy( Conf_Server[Conf_Server_Count].name, "" );
strcpy( Conf_Server[Conf_Server_Count].pwd, "" );
Conf_Server[Conf_Server_Count].port = 0;
+ Conf_Server[Conf_Server_Count].group = -1;
Conf_Server[Conf_Server_Count].lasttry = time( NULL ) - Conf_ConnectRetry + STARTUP_DELAY;
Conf_Server[Conf_Server_Count].res_stat = NULL;
Conf_Server_Count++;
@@ -322,7 +326,7 @@ GLOBAL VOID Handle_OPERATOR( INT Line, CHAR *Var, CHAR *Arg )
GLOBAL VOID Handle_SERVER( INT Line, CHAR *Var, CHAR *Arg )
{
- INT port;
+ INT32 port;
assert( Line > 0 );
assert( Var != NULL );
@@ -353,10 +357,16 @@ GLOBAL VOID Handle_SERVER( INT Line, CHAR *Var, CHAR *Arg )
{
/* Port, zu dem Verbunden werden soll */
port = atol( Arg );
- if( port > 0 && port < 0xFFFF ) Conf_Server[Conf_Server_Count - 1].port = port;
+ if( port > 0 && port < 0xFFFF ) Conf_Server[Conf_Server_Count - 1].port = (INT)port;
else Log( LOG_ERR, "%s, line %d (section \"Server\"): Illegal port number %ld!", Conf_File, Line, port );
return;
}
+ if( strcasecmp( Var, "Group" ) == 0 )
+ {
+ /* Server-Gruppe */
+ Conf_Server[Conf_Server_Count - 1].group = atoi( Arg );
+ return;
+ }
Log( LOG_ERR, "%s, line %d (section \"Server\"): Unknown variable \"%s\"!", Conf_File, Line, Var );
} /* Handle_SERVER */
diff --git a/src/ngircd/conf.h b/src/ngircd/conf.h
--- a/src/ngircd/conf.h
+++ b/src/ngircd/conf.h
@@ -9,11 +9,14 @@
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
*
- * $Id: conf.h,v 1.10 2002/02/27 23:23:53 alex Exp $
+ * $Id: conf.h,v 1.11 2002/03/10 17:50:48 alex Exp $
*
* conf.h: Konfiguration des ngircd (Header)
*
* $Log: conf.h,v $
+ * Revision 1.11 2002/03/10 17:50:48 alex
+ * - Handling von "--version" und "--help" nochmal geaendert ...
+ *
* Revision 1.10 2002/02/27 23:23:53 alex
* - Includes fuer einige Header bereinigt.
*
@@ -56,19 +59,20 @@
typedef struct _Conf_Oper
{
- CHAR name[CLIENT_PASS_LEN];
- CHAR pwd[CLIENT_PASS_LEN];
+ CHAR name[CLIENT_PASS_LEN]; /* Name (ID) des IRC-OPs */
+ CHAR pwd[CLIENT_PASS_LEN]; /* Passwort */
} CONF_OPER;
typedef struct _Conf_Server
{
- CHAR host[HOST_LEN];
- CHAR ip[16];
- CHAR name[CLIENT_ID_LEN];
- CHAR pwd[CLIENT_PASS_LEN];
- INT port;
- time_t lasttry;
- RES_STAT *res_stat;
+ CHAR host[HOST_LEN]; /* Hostname */
+ CHAR ip[16]; /* IP-Adresse (von Resolver) */
+ CHAR name[CLIENT_ID_LEN]; /* IRC-Client-ID */
+ CHAR pwd[CLIENT_PASS_LEN]; /* Passwort */
+ INT port; /* Server-Port */
+ INT group; /* Gruppe des Servers */
+ time_t lasttry; /* Letzter Connect-Versuch */
+ RES_STAT *res_stat; /* Status des Resolver */
} CONF_SERVER;
diff --git a/src/ngircd/conn.c b/src/ngircd/conn.c
--- a/src/ngircd/conn.c
+++ b/src/ngircd/conn.c
@@ -9,11 +9,14 @@
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
*
- * $Id: conn.c,v 1.47 2002/03/04 23:16:23 alex Exp $
+ * $Id: conn.c,v 1.48 2002/03/10 17:50:48 alex Exp $
*
* connect.h: Verwaltung aller Netz-Verbindungen ("connections")
*
* $Log: conn.c,v $
+ * Revision 1.48 2002/03/10 17:50:48 alex
+ * - Handling von "--version" und "--help" nochmal geaendert ...
+ *
* Revision 1.47 2002/03/04 23:16:23 alex
* - Logging geaendert: detaillierter im Syslog, "allgemeiner" fuer Clients.
*
@@ -1008,6 +1011,7 @@ LOCAL VOID Check_Servers( VOID )
/* Haben wir schon eine Verbindung? */
for( n = 0; n < MAX_CONNECTIONS; n++ )
{
+ /* Verbindung zu diesem Server? */
if(( My_Connections[n].sock != NONE ) && ( My_Connections[n].our_server == i ))
{
/* Komplett aufgebaute Verbindung? */
@@ -1016,6 +1020,12 @@ LOCAL VOID Check_Servers( VOID )
/* IP schon aufgeloest? */
if( My_Connections[n].res_stat == NULL ) New_Server( i, n );
}
+
+ /* Verbindung in dieser Server-Gruppe? */
+ if(( My_Connections[n].sock != NONE ) && ( My_Connections[n].our_server != NONE ))
+ {
+ if( Conf_Server[n].group == Conf_Server[i].group != NONE ) break;
+ }
}
if( n < MAX_CONNECTIONS ) continue;
@@ -1145,7 +1155,7 @@ LOCAL VOID Init_Conn_Struct( INT Idx )
My_Connections[Idx].rdatalen = 0;
My_Connections[Idx].wbuf[0] = '\0';
My_Connections[Idx].wdatalen = 0;
- My_Connections[Idx].our_server = -1;
+ My_Connections[Idx].our_server = NONE;
My_Connections[Idx].lastdata = time( NULL );
My_Connections[Idx].lastping = 0;
My_Connections[Idx].lastprivmsg = time( NULL );
diff --git a/src/ngircd/ngircd.c b/src/ngircd/ngircd.c
--- a/src/ngircd/ngircd.c
+++ b/src/ngircd/ngircd.c
@@ -9,11 +9,14 @@
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
*
- * $Id: ngircd.c,v 1.30 2002/03/10 17:45:41 alex Exp $
+ * $Id: ngircd.c,v 1.31 2002/03/10 17:50:48 alex Exp $
*
* ngircd.c: Hier beginnt alles ;-)
*
* $Log: ngircd.c,v $
+ * Revision 1.31 2002/03/10 17:50:48 alex
+ * - Handling von "--version" und "--help" nochmal geaendert ...
+ *
* Revision 1.30 2002/03/10 17:45:41 alex
* - bei "ngircd --version" werden nun die eincompilierten Pfade angezeigt.
*
@@ -210,7 +213,7 @@ GLOBAL INT main( INT argc, CONST CHAR *argv[] )
#endif
if( strcmp( argv[i], "--version" ) == 0 )
{
- Show_Version( ); puts( "" );
+ Show_Version( );
exit( 1 );
}
}
@@ -489,15 +492,16 @@ LOCAL VOID Show_Version( VOID )
puts( "Copyright (c)2001,2002 by Alexander Barton (alex@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." );
- puts( "\nCompile-time defaults:\n" );
- puts( " - configuration: "CONFIG_FILE );
- puts( " - MOTD file: "MOTD_FILE );
- puts( " - server error log: "ERROR_FILE );
} /* Show_Version */
LOCAL VOID Show_Help( VOID )
{
+ puts( "Compile-time defaults:\n" );
+ puts( " - configuration: "CONFIG_FILE );
+ puts( " - MOTD file: "MOTD_FILE );
+ puts( " - server error log: "ERROR_FILE"\n" );
+ puts( "Run-time options:\n" );
#ifdef DEBUG
puts( " -d, --debug log extra debug messages" );
#endif
-----END OF PAGE-----