1
0
mirror of https://github.com/osmarks/ngircd.git synced 2025-05-18 23:24:09 +00:00

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 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, - New configuration variable "PidFile", section "[Global]": if defined,
the server writes its process ID (PID) to this file. Default: off. the server writes its process ID (PID) to this file. Default: off.
Idea of Florian Westphal, <westphal@foo.fh-furtwangen.de>. 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" #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 "imp.h"
#include <assert.h> #include <assert.h>
@ -530,9 +530,9 @@ IRC_VERSION( CLIENT *Client, REQUEST *Req )
strncpy( ver + 4, ver + 5, 2 ); strncpy( ver + 4, ver + 5, 2 );
strncpy( ver + 6, ver + 8, 3 ); strncpy( ver + 6, ver + 8, 3 );
snprintf( vertxt, sizeof( vertxt ), "%s(%s)", PACKAGE_VERSION, ver ); 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 #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 #endif
} /* IRC_VERSION */ } /* IRC_VERSION */

View File

@ -14,7 +14,7 @@
#include "portab.h" #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 "imp.h"
#include <assert.h> #include <assert.h>
@ -60,7 +60,7 @@ Log_Init( VOID )
#endif #endif
/* Hello World! */ /* Hello World! */
Log( LOG_NOTICE, "%s started.", NGIRCd_Version( )); Log( LOG_NOTICE, "%s started.", NGIRCd_Version );
/* Informationen uebern den "Operation Mode" */ /* Informationen uebern den "Operation Mode" */
Init_Txt[0] = '\0'; Init_Txt[0] = '\0';
@ -112,7 +112,7 @@ Log_InitErrorfile( VOID )
/* Einige Infos in das Error-File schreiben */ /* Einige Infos in das Error-File schreiben */
fputs( ctime( &NGIRCd_Start ), stderr ); 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 : "-" ); fprintf( stderr, "Activating: %s\n\n", Init_Txt[0] ? Init_Txt : "-" );
fflush( stderr ); fflush( stderr );

View File

@ -14,7 +14,7 @@
#include "portab.h" #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 "imp.h"
#include <assert.h> #include <assert.h>
@ -60,6 +60,8 @@ LOCAL VOID Show_Help PARAMS(( VOID ));
LOCAL VOID Pidfile_Create PARAMS(( LONG )); LOCAL VOID Pidfile_Create PARAMS(( LONG ));
LOCAL VOID Pidfile_Delete PARAMS(( VOID )); LOCAL VOID Pidfile_Delete PARAMS(( VOID ));
LOCAL VOID NGIRCd_FillVersion PARAMS(( VOID ));
GLOBAL int GLOBAL int
main( int argc, const char *argv[] ) main( int argc, const char *argv[] )
@ -83,6 +85,8 @@ main( int argc, const char *argv[] )
strlcpy( NGIRCd_ConfFile, SYSCONFDIR, sizeof( NGIRCd_ConfFile )); strlcpy( NGIRCd_ConfFile, SYSCONFDIR, sizeof( NGIRCd_ConfFile ));
strlcat( NGIRCd_ConfFile, CONFIG_FILE, sizeof( NGIRCd_ConfFile )); strlcat( NGIRCd_ConfFile, CONFIG_FILE, sizeof( NGIRCd_ConfFile ));
NGIRCd_FillVersion( );
/* Kommandozeile parsen */ /* Kommandozeile parsen */
for( i = 1; i < argc; i++ ) for( i = 1; i < argc; i++ )
{ {
@ -210,7 +214,7 @@ main( int argc, const char *argv[] )
} }
/* Debug-Level (fuer IRC-Befehl "VERSION") ermitteln */ /* Debug-Level (fuer IRC-Befehl "VERSION") ermitteln */
strcpy( NGIRCd_DebugLevel, "" ); NGIRCd_DebugLevel[0] = '\0';
#ifdef DEBUG #ifdef DEBUG
if( NGIRCd_Debug ) strcpy( NGIRCd_DebugLevel, "1" ); if( NGIRCd_Debug ) strcpy( NGIRCd_DebugLevel, "1" );
#endif #endif
@ -381,73 +385,60 @@ main( int argc, const char *argv[] )
} /* main */ } /* main */
GLOBAL CHAR * LOCAL VOID
NGIRCd_Version( VOID ) NGIRCd_FillVersion( VOID )
{ {
STATIC CHAR version[126]; NGIRCd_VersionAddition[0] = '\0';
#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, "" );
#ifdef SYSLOG #ifdef SYSLOG
if( txt[0] ) strcat( txt, "+" ); strcpy( NGIRCd_VersionAddition, "SYSLOG" );
strcat( txt, "SYSLOG" );
#endif #endif
#ifdef ZLIB #ifdef ZLIB
if( txt[0] ) strcat( txt, "+" ); if( NGIRCd_VersionAddition[0] ) strcat( NGIRCd_VersionAddition, "+" );
strcat( txt, "ZLIB" ); strcat( NGIRCd_VersionAddition, "ZLIB" );
#endif #endif
#ifdef TCPWRAP #ifdef TCPWRAP
if( txt[0] ) strcat( txt, "+" ); if( NGIRCd_VersionAddition[0] ) strcat( NGIRCd_VersionAddition, "+" );
strcat( txt, "TCPWRAP" ); strcat( NGIRCd_VersionAddition, "TCPWRAP" );
#endif #endif
#ifdef RENDEZVOUS #ifdef RENDEZVOUS
if( txt[0] ) strcat( txt, "+" ); if( NGIRCd_VersionAddition[0] ) strcat( NGIRCd_VersionAddition, "+" );
strcat( txt, "RENDEZVOUS" ); strcat( NGIRCd_VersionAddition, "RENDEZVOUS" );
#endif #endif
#ifdef IDENTAUTH #ifdef IDENTAUTH
if( txt[0] ) strcat( txt, "+" ); if( NGIRCd_VersionAddition[0] ) strcat( NGIRCd_VersionAddition, "+" );
strcat( txt, "IDENT" ); strcat( NGIRCd_VersionAddition, "IDENT" );
#endif #endif
#ifdef DEBUG #ifdef DEBUG
if( txt[0] ) strcat( txt, "+" ); if( NGIRCd_VersionAddition[0] ) strcat( NGIRCd_VersionAddition, "+" );
strcat( txt, "DEBUG" ); strcat( NGIRCd_VersionAddition, "DEBUG" );
#endif #endif
#ifdef SNIFFER #ifdef SNIFFER
if( txt[0] ) strcat( txt, "+" ); if( NGIRCd_VersionAddition[0] ) strcat( NGIRCd_VersionAddition, "+" );
strcat( txt, "SNIFFER" ); strcat( NGIRCd_VersionAddition, "SNIFFER" );
#endif #endif
#ifdef STRICT_RFC #ifdef STRICT_RFC
if( txt[0] ) strcat( txt, "+" ); if( NGIRCd_VersionAddition[0] ) strcat( NGIRCd_VersionAddition, "+" );
strcat( txt, "RFC" ); strcat( NGIRCd_VersionAddition, "RFC" );
#endif #endif
#ifdef IRCPLUS #ifdef IRCPLUS
if( txt[0] ) strcat( txt, "+" ); if( NGIRCd_VersionAddition[0] ) strcat( NGIRCd_VersionAddition, "+" );
strcat( txt, "IRCPLUS" ); strcat( NGIRCd_VersionAddition, "IRCPLUS" );
#endif #endif
if( txt[0] ) strlcat( txt, "-", sizeof( txt )); if( NGIRCd_VersionAddition[0] ) strlcat( NGIRCd_VersionAddition, "-", sizeof( NGIRCd_VersionAddition ));
strlcat( txt, TARGET_CPU, sizeof( txt )); strlcat( NGIRCd_VersionAddition, TARGET_CPU, sizeof( NGIRCd_VersionAddition ));
strlcat( txt, "/", sizeof( txt )); strlcat( NGIRCd_VersionAddition, "/", sizeof( NGIRCd_VersionAddition ));
strlcat( txt, TARGET_VENDOR, sizeof( txt )); strlcat( NGIRCd_VersionAddition, TARGET_VENDOR, sizeof( NGIRCd_VersionAddition ));
strlcat( txt, "/", sizeof( txt )); strlcat( NGIRCd_VersionAddition, "/", sizeof( NGIRCd_VersionAddition ));
strlcat( txt, TARGET_OS, sizeof( txt )); strlcat( NGIRCd_VersionAddition, TARGET_OS, sizeof( NGIRCd_VersionAddition ));
return txt; #ifdef CVSDATE
} /* NGIRCd_VersionAddition */ 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 GLOBAL VOID
@ -569,7 +560,7 @@ Signal_Handler( INT Signal )
LOCAL VOID LOCAL VOID
Show_Version( VOID ) Show_Version( VOID )
{ {
puts( NGIRCd_Version( )); puts( NGIRCd_Version );
puts( "Copyright (c)2001-2005 by Alexander Barton (<alex@barton.de>)." ); puts( "Copyright (c)2001-2005 by Alexander Barton (<alex@barton.de>)." );
puts( "Homepage: <http://arthur.ath.cx/~alex/ngircd/>\n" ); puts( "Homepage: <http://arthur.ath.cx/~alex/ngircd/>\n" );
puts( "This is free software; see the source for copying conditions. There is NO" ); 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. * (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information. * 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". * Prototypes of the "main module".
*/ */
@ -24,6 +24,8 @@
GLOBAL time_t NGIRCd_Start; /* Startzeitpunkt des Daemon */ GLOBAL time_t NGIRCd_Start; /* Startzeitpunkt des Daemon */
GLOBAL CHAR NGIRCd_StartStr[64]; GLOBAL CHAR NGIRCd_StartStr[64];
GLOBAL CHAR NGIRCd_Version[126];
GLOBAL CHAR NGIRCd_VersionAddition[126];
#ifdef DEBUG #ifdef DEBUG
GLOBAL BOOLEAN NGIRCd_Debug; /* Debug-Modus aktivieren */ 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_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 )); GLOBAL VOID NGIRCd_Rehash PARAMS(( VOID ));