Don't create version information string each time a client connects but

insetead on server startup. By Florian Westphal.
This commit is contained in:
Alexander Barton 2005-02-09 09:52:58 +00:00
parent c16d1b03aa
commit 894cd2cd68
5 changed files with 52 additions and 60 deletions

View File

@ -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 $

View File

@ -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 */

View File

@ -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 );

View File

@ -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,6 +60,8 @@ 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[] )
@ -83,6 +85,8 @@ main( int argc, const char *argv[] )
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,73 +385,60 @@ main( int argc, const char *argv[] )
} /* main */
GLOBAL CHAR *
NGIRCd_Version( VOID )
LOCAL VOID
NGIRCd_FillVersion( 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 )
{
STATIC CHAR txt[200];
strcpy( txt, "" );
NGIRCd_VersionAddition[0] = '\0';
#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
@ -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" );

View File

@ -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]; /* Konfigurationsdatei */
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 ));