Commit Diff


commit - c16d1b03aae1ca3d3817457c114d9dd422fcc672
commit + 894cd2cd685ef17029c260c96801d082c71aac11
blob - b5d799d5717b95f7b0b2032adce5f0258ed22e4f
blob + 7694623b7aa4d3c0c5b9689002c7ae953156bc01
--- ChangeLog
+++ ChangeLog
@@ -12,6 +12,8 @@
 
 ngIRCd CVSHEAD
 
+  - Don't create version information string each time a client connects
+    but insetead on server startup. By Florian Westphal.
   - New configuration variable "PidFile", section "[Global]": if defined,
     the server writes its process ID (PID) to this file. Default: off.
     Idea of Florian Westphal, <westphal@foo.fh-furtwangen.de>.
@@ -582,4 +584,4 @@ ngIRCd 0.0.1, 31.12.2001
 
 
 -- 
-$Id: ChangeLog,v 1.259 2005/02/04 14:24:20 alex Exp $
+$Id: ChangeLog,v 1.260 2005/02/09 09:52:58 alex Exp $
blob - ec66ee5383402b896099263e121707edd4f4328a
blob + 0d7246f82f389e437ca90c1efd422fedb6e73492
--- src/ngircd/irc-info.c
+++ src/ngircd/irc-info.c
@@ -14,7 +14,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: irc-info.c,v 1.25 2005/02/04 13:15:38 alex Exp $";
+static char UNUSED id[] = "$Id: irc-info.c,v 1.26 2005/02/09 09:52:58 alex Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -530,9 +530,9 @@ IRC_VERSION( CLIENT *Client, REQUEST *Req )
 	strncpy( ver + 4, ver + 5, 2 );
 	strncpy( ver + 6, ver + 8, 3 );
 	snprintf( vertxt, sizeof( vertxt ), "%s(%s)", PACKAGE_VERSION, ver );
-	return IRC_WriteStrClient( Client, RPL_VERSION_MSG, Client_ID( prefix ), PACKAGE_NAME, vertxt, NGIRCd_DebugLevel, Conf_ServerName, NGIRCd_VersionAddition( ));
+	return IRC_WriteStrClient( Client, RPL_VERSION_MSG, Client_ID( prefix ), PACKAGE_NAME, vertxt, NGIRCd_DebugLevel, Conf_ServerName, NGIRCd_VersionAddition );
 #else
-	return IRC_WriteStrClient( Client, RPL_VERSION_MSG, Client_ID( prefix ), PACKAGE_NAME, PACKAGE_VERSION, NGIRCd_DebugLevel, Conf_ServerName, NGIRCd_VersionAddition( ));
+	return IRC_WriteStrClient( Client, RPL_VERSION_MSG, Client_ID( prefix ), PACKAGE_NAME, PACKAGE_VERSION, NGIRCd_DebugLevel, Conf_ServerName, NGIRCd_VersionAddition );
 #endif
 } /* IRC_VERSION */
 
blob - ec284269cdbbe8870135cde6b0afbf3234c3d0a3
blob + 01821829c1b023a68a368c5017aebb43e0c2f1e9
--- src/ngircd/log.c
+++ src/ngircd/log.c
@@ -14,7 +14,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: log.c,v 1.50 2005/02/03 09:26:42 alex Exp $";
+static char UNUSED id[] = "$Id: log.c,v 1.51 2005/02/09 09:52:58 alex Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -60,7 +60,7 @@ Log_Init( VOID )
 #endif
 
 	/* Hello World! */
-	Log( LOG_NOTICE, "%s started.", NGIRCd_Version( ));
+	Log( LOG_NOTICE, "%s started.", NGIRCd_Version );
 	  
 	/* Informationen uebern den "Operation Mode" */
 	Init_Txt[0] = '\0';
@@ -112,7 +112,7 @@ Log_InitErrorfile( VOID )
 
 	/* Einige Infos in das Error-File schreiben */
 	fputs( ctime( &NGIRCd_Start ), stderr );
-	fprintf( stderr, "%s started.\n", NGIRCd_Version( ));
+	fprintf( stderr, "%s started.\n", NGIRCd_Version );
 	fprintf( stderr, "Activating: %s\n\n", Init_Txt[0] ? Init_Txt : "-" );
 	fflush( stderr );
 
blob - f85ce5bde2034bf1d6e13908802ed96e51b55f97
blob + 191c216a1ac0df60fe38362338328c82e6500250
--- src/ngircd/ngircd.c
+++ src/ngircd/ngircd.c
@@ -14,7 +14,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: ngircd.c,v 1.89 2005/02/07 19:31:34 alex Exp $";
+static char UNUSED id[] = "$Id: ngircd.c,v 1.90 2005/02/09 09:52:58 alex Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -60,7 +60,9 @@ LOCAL VOID Show_Help PARAMS(( VOID ));
 LOCAL VOID Pidfile_Create PARAMS(( LONG ));
 LOCAL VOID Pidfile_Delete PARAMS(( VOID ));
 
+LOCAL VOID NGIRCd_FillVersion PARAMS(( VOID ));
 
+
 GLOBAL int
 main( int argc, const char *argv[] )
 {
@@ -82,6 +84,8 @@ main( int argc, const char *argv[] )
 #endif
 	strlcpy( NGIRCd_ConfFile, SYSCONFDIR, sizeof( NGIRCd_ConfFile ));
 	strlcat( NGIRCd_ConfFile, CONFIG_FILE, sizeof( NGIRCd_ConfFile ));
+
+	NGIRCd_FillVersion( );
 
 	/* Kommandozeile parsen */
 	for( i = 1; i < argc; i++ )
@@ -210,7 +214,7 @@ main( int argc, const char *argv[] )
 	}
 
 	/* Debug-Level (fuer IRC-Befehl "VERSION") ermitteln */
-	strcpy( NGIRCd_DebugLevel, "" );
+	NGIRCd_DebugLevel[0] = '\0';
 #ifdef DEBUG
 	if( NGIRCd_Debug ) strcpy( NGIRCd_DebugLevel, "1" );
 #endif
@@ -381,75 +385,62 @@ main( int argc, const char *argv[] )
 } /* main */
 
 
-GLOBAL CHAR *
-NGIRCd_Version( VOID )
-{
-	STATIC CHAR version[126];
-	
-#ifdef CVSDATE
-	sprintf( version, "%s %s(%s)-%s", PACKAGE_NAME, PACKAGE_VERSION, CVSDATE, NGIRCd_VersionAddition( ));
-#else
-	sprintf( version, "%s %s-%s", PACKAGE_NAME, PACKAGE_VERSION, NGIRCd_VersionAddition( ));
-#endif
-	return version;
-} /* NGIRCd_Version */
-
-
-GLOBAL CHAR *
-NGIRCd_VersionAddition( VOID )
+LOCAL VOID
+NGIRCd_FillVersion( VOID )
 {
-	STATIC CHAR txt[200];
+	NGIRCd_VersionAddition[0] = '\0';
 
-	strcpy( txt, "" );
-
 #ifdef SYSLOG
-	if( txt[0] ) strcat( txt, "+" );
-	strcat( txt, "SYSLOG" );
+	strcpy( NGIRCd_VersionAddition, "SYSLOG" );
 #endif
 #ifdef ZLIB
-	if( txt[0] ) strcat( txt, "+" );
-	strcat( txt, "ZLIB" );
+	if( NGIRCd_VersionAddition[0] ) strcat( NGIRCd_VersionAddition, "+" );
+	strcat( NGIRCd_VersionAddition, "ZLIB" );
 #endif
 #ifdef TCPWRAP
-	if( txt[0] ) strcat( txt, "+" );
-	strcat( txt, "TCPWRAP" );
+	if( NGIRCd_VersionAddition[0] ) strcat( NGIRCd_VersionAddition, "+" );
+	strcat( NGIRCd_VersionAddition, "TCPWRAP" );
 #endif
 #ifdef RENDEZVOUS
-	if( txt[0] ) strcat( txt, "+" );
-	strcat( txt, "RENDEZVOUS" );
+	if( NGIRCd_VersionAddition[0] ) strcat( NGIRCd_VersionAddition, "+" );
+	strcat( NGIRCd_VersionAddition, "RENDEZVOUS" );
 #endif
 #ifdef IDENTAUTH
-	if( txt[0] ) strcat( txt, "+" );
-	strcat( txt, "IDENT" );
+	if( NGIRCd_VersionAddition[0] ) strcat( NGIRCd_VersionAddition, "+" );
+	strcat( NGIRCd_VersionAddition, "IDENT" );
 #endif
 #ifdef DEBUG
-	if( txt[0] ) strcat( txt, "+" );
-	strcat( txt, "DEBUG" );
+	if( NGIRCd_VersionAddition[0] ) strcat( NGIRCd_VersionAddition, "+" );
+	strcat( NGIRCd_VersionAddition, "DEBUG" );
 #endif
 #ifdef SNIFFER
-	if( txt[0] ) strcat( txt, "+" );
-	strcat( txt, "SNIFFER" );
+	if( NGIRCd_VersionAddition[0] ) strcat( NGIRCd_VersionAddition, "+" );
+	strcat( NGIRCd_VersionAddition, "SNIFFER" );
 #endif
 #ifdef STRICT_RFC
-	if( txt[0] ) strcat( txt, "+" );
-	strcat( txt, "RFC" );
+	if( NGIRCd_VersionAddition[0] ) strcat( NGIRCd_VersionAddition, "+" );
+	strcat( NGIRCd_VersionAddition, "RFC" );
 #endif
 #ifdef IRCPLUS
-	if( txt[0] ) strcat( txt, "+" );
-	strcat( txt, "IRCPLUS" );
+	if( NGIRCd_VersionAddition[0] ) strcat( NGIRCd_VersionAddition, "+" );
+	strcat( NGIRCd_VersionAddition, "IRCPLUS" );
 #endif
-	
-	if( txt[0] ) strlcat( txt, "-", sizeof( txt ));
-	strlcat( txt, TARGET_CPU, sizeof( txt ));
-	strlcat( txt, "/", sizeof( txt ));
-	strlcat( txt, TARGET_VENDOR, sizeof( txt ));
-	strlcat( txt, "/", sizeof( txt ));
-	strlcat( txt, TARGET_OS, sizeof( txt ));
 
-	return txt;
-} /* NGIRCd_VersionAddition */
+	if( NGIRCd_VersionAddition[0] ) strlcat( NGIRCd_VersionAddition, "-", sizeof( NGIRCd_VersionAddition ));
+	strlcat( NGIRCd_VersionAddition, TARGET_CPU, sizeof( NGIRCd_VersionAddition ));
+	strlcat( NGIRCd_VersionAddition, "/", sizeof( NGIRCd_VersionAddition ));
+	strlcat( NGIRCd_VersionAddition, TARGET_VENDOR, sizeof( NGIRCd_VersionAddition ));
+	strlcat( NGIRCd_VersionAddition, "/", sizeof( NGIRCd_VersionAddition ));
+	strlcat( NGIRCd_VersionAddition, TARGET_OS, sizeof( NGIRCd_VersionAddition ));
 
+#ifdef CVSDATE
+	snprintf( NGIRCd_Version, sizeof NGIRCd_Version,"%s %s(%s)-%s", PACKAGE_NAME, PACKAGE_VERSION, CVSDATE, NGIRCd_VersionAddition);
+#else
+	snprintf( NGIRCd_Version, sizeof NGIRCd_Version, "%s %s-%s", PACKAGE_NAME, PACKAGE_VERSION, NGIRCd_VersionAddition);
+#endif
+} /* NGIRCd_FillVersion */
 
+
 GLOBAL VOID
 NGIRCd_Rehash( VOID )
 {
@@ -569,7 +560,7 @@ Signal_Handler( INT Signal )
 LOCAL VOID
 Show_Version( VOID )
 {
-	puts( NGIRCd_Version( ));
+	puts( NGIRCd_Version );
 	puts( "Copyright (c)2001-2005 by Alexander Barton (<alex@barton.de>)." );
 	puts( "Homepage: <http://arthur.ath.cx/~alex/ngircd/>\n" );
 	puts( "This is free software; see the source for copying conditions. There is NO" );
blob - 60fb0ba9a1a9554b8b1c6dd2dc9b3eb44388a8b0
blob + b82f312b284c141753619816b33da85a7d3c2767
--- src/ngircd/ngircd.h
+++ src/ngircd/ngircd.h
@@ -8,7 +8,7 @@
  * (at your option) any later version.
  * Please read the file COPYING, README and AUTHORS for more information.
  *
- * $Id: ngircd.h,v 1.19 2002/12/26 16:48:14 alex Exp $
+ * $Id: ngircd.h,v 1.20 2005/02/09 09:52:58 alex Exp $
  *
  * Prototypes of the "main module".
  */
@@ -24,6 +24,8 @@
 
 GLOBAL time_t NGIRCd_Start;		/* Startzeitpunkt des Daemon */
 GLOBAL CHAR NGIRCd_StartStr[64];
+GLOBAL CHAR NGIRCd_Version[126];
+GLOBAL CHAR NGIRCd_VersionAddition[126];
 
 #ifdef DEBUG
 GLOBAL BOOLEAN NGIRCd_Debug;		/* Debug-Modus aktivieren */
@@ -48,9 +50,6 @@ GLOBAL CHAR NGIRCd_ConfFile[FNAME_LEN];	/* Konfigurati
 GLOBAL CHAR NGIRCd_ProtoID[COMMAND_LEN];/* Protokoll- und Server-Identifikation */
 
 
-GLOBAL CHAR *NGIRCd_Version PARAMS((VOID ));
-GLOBAL CHAR *NGIRCd_VersionAddition PARAMS((VOID ));
-
 GLOBAL VOID NGIRCd_Rehash PARAMS(( VOID ));