X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fngircd%2Fconf.c;h=fa1bfba1da4d0872d39e016da6aa71982174216d;hb=f68aa02272d05ffbceea9e0188984d9bf9b83dd1;hp=423221cbbb108262e10de17e37b8e66a82712e2b;hpb=588af510a35b5b28cb8c1063ac865f86c65d7a8a;p=ngircd.git diff --git a/src/ngircd/conf.c b/src/ngircd/conf.c index 423221cb..fa1bfba1 100644 --- a/src/ngircd/conf.c +++ b/src/ngircd/conf.c @@ -54,6 +54,7 @@ static CONF_SERVER New_Server; static int New_Server_Idx; static char Conf_MotdFile[FNAME_LEN]; +static char Conf_HelpFile[FNAME_LEN]; static void Set_Defaults PARAMS(( bool InitServers )); static bool Read_Config PARAMS(( bool TestOnly, bool IsStarting )); @@ -316,6 +317,7 @@ Conf_Test( void ) printf(" AdminInfo1 = %s\n", Conf_ServerAdmin1); printf(" AdminInfo2 = %s\n", Conf_ServerAdmin2); printf(" AdminEMail = %s\n", Conf_ServerAdminMail); + printf(" HelpFile = %s\n", Conf_HelpFile); printf(" Info = %s\n", Conf_ServerInfo); printf(" Listen = %s\n", Conf_ListenAddress); if (Using_MotdFile) { @@ -701,8 +703,11 @@ Set_Defaults(bool InitServers) Conf_ListenAddress = NULL; array_free(&Conf_ListenPorts); array_free(&Conf_Motd); + array_free(&Conf_Helptext); strlcpy(Conf_MotdFile, SYSCONFDIR, sizeof(Conf_MotdFile)); strlcat(Conf_MotdFile, MOTD_FILE, sizeof(Conf_MotdFile)); + strlcpy(Conf_HelpFile, SYSCONFDIR, sizeof(Conf_HelpFile)); + strlcat(Conf_HelpFile, HELP_FILE, sizeof(Conf_HelpFile)); strcpy(Conf_ServerPwd, ""); strlcpy(Conf_PidFile, PID_FILE, sizeof(Conf_PidFile)); Conf_UID = Conf_GID = 0; @@ -1047,6 +1052,12 @@ Read_Config(bool TestOnly, bool IsStarting) Using_MotdFile = true; } + /* Try to read ngIRCd help text file. */ + (void)Read_TextFile(Conf_HelpFile, "help text", &Conf_Helptext); + if (!array_bytes(&Conf_Helptext)) + Config_Error(LOG_WARNING, + "No help text available, HELP command will be of limited use."); + #ifdef SSL_SUPPORT /* Make sure that all SSL-related files are readable */ CheckFileReadable("CertFile", Conf_SSLOptions.CertFile); @@ -1312,6 +1323,12 @@ Handle_GLOBAL( int Line, char *Var, char *Arg ) Config_Error_TooLong(Line, Var); return; } + if (strcasecmp(Var, "HelpFile") == 0) { + len = strlcpy(Conf_HelpFile, Arg, sizeof(Conf_HelpFile)); + if (len >= sizeof(Conf_HelpFile)) + Config_Error_TooLong(Line, Var); + return; + } if (strcasecmp(Var, "Listen") == 0) { if (Conf_ListenAddress) { Config_Error(LOG_ERR,