mirror of
https://github.com/osmarks/ngircd.git
synced 2025-10-31 22:13:00 +00:00
--configtest: remember if MOTD is configured by file or phrase
Configuration variables "MotdFile" and "MotdPhrase" are mutually exclusive; so don't display content in both of them when running "ngircd --configtest": instead remember which one is beeing used.
This commit is contained in:
@@ -49,7 +49,7 @@
|
|||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
|
|
||||||
|
|
||||||
static bool Use_Log = true;
|
static bool Use_Log = true, Using_MotdFile = true;
|
||||||
static CONF_SERVER New_Server;
|
static CONF_SERVER New_Server;
|
||||||
static int New_Server_Idx;
|
static int New_Server_Idx;
|
||||||
|
|
||||||
@@ -300,8 +300,14 @@ Conf_Test( void )
|
|||||||
printf(" AdminInfo1 = %s\n", Conf_ServerAdmin1);
|
printf(" AdminInfo1 = %s\n", Conf_ServerAdmin1);
|
||||||
printf(" AdminInfo2 = %s\n", Conf_ServerAdmin2);
|
printf(" AdminInfo2 = %s\n", Conf_ServerAdmin2);
|
||||||
printf(" AdminEMail = %s\n", Conf_ServerAdminMail);
|
printf(" AdminEMail = %s\n", Conf_ServerAdminMail);
|
||||||
printf(" MotdFile = %s\n", Conf_MotdFile);
|
if (Using_MotdFile) {
|
||||||
printf(" MotdPhrase = %.32s\n", array_bytes(&Conf_Motd) ? (const char*) array_start(&Conf_Motd) : "");
|
printf(" MotdFile = %s\n", Conf_MotdFile);
|
||||||
|
printf(" MotdPhrase =\n");
|
||||||
|
} else {
|
||||||
|
printf(" MotdFile = \n");
|
||||||
|
printf(" MotdPhrase = %s\n", array_bytes(&Conf_Motd)
|
||||||
|
? (const char*) array_start(&Conf_Motd) : "");
|
||||||
|
}
|
||||||
printf(" ChrootDir = %s\n", Conf_Chroot);
|
printf(" ChrootDir = %s\n", Conf_Chroot);
|
||||||
printf(" PidFile = %s\n", Conf_PidFile);
|
printf(" PidFile = %s\n", Conf_PidFile);
|
||||||
printf(" Listen = %s\n", Conf_ListenAddress);
|
printf(" Listen = %s\n", Conf_ListenAddress);
|
||||||
@@ -649,6 +655,7 @@ Read_Motd(const char *filename)
|
|||||||
}
|
}
|
||||||
|
|
||||||
array_free(&Conf_Motd);
|
array_free(&Conf_Motd);
|
||||||
|
Using_MotdFile = true;
|
||||||
|
|
||||||
while (fgets(line, (int)sizeof line, fp)) {
|
while (fgets(line, (int)sizeof line, fp)) {
|
||||||
ngt_TrimLastChr( line, '\n');
|
ngt_TrimLastChr( line, '\n');
|
||||||
@@ -951,6 +958,7 @@ Handle_GLOBAL( int Line, char *Var, char *Arg )
|
|||||||
if (!array_copyb(&Conf_Motd, Arg, len + 1))
|
if (!array_copyb(&Conf_Motd, Arg, len + 1))
|
||||||
Config_Error(LOG_WARNING, "%s, line %d: Could not append MotdPhrase: %s",
|
Config_Error(LOG_WARNING, "%s, line %d: Could not append MotdPhrase: %s",
|
||||||
NGIRCd_ConfFile, Line, strerror(errno));
|
NGIRCd_ConfFile, Line, strerror(errno));
|
||||||
|
Using_MotdFile = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if( strcasecmp( Var, "ChrootDir" ) == 0 ) {
|
if( strcasecmp( Var, "ChrootDir" ) == 0 ) {
|
||||||
|
|||||||
Reference in New Issue
Block a user