1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-09 09:03:12 +02:00

Made ./unreal configtest

This commit is contained in:
trocotronic
2007-01-27 15:45:41 +00:00
parent 8ffb35563d
commit 067416d76a
5 changed files with 40 additions and 4 deletions
+1
View File
@@ -1533,3 +1533,4 @@
to check again, suggested by vonitsanet (#0003136).
- Fixed a typo in help.conf, reported by Sakkath (#0003196).
- Added extended ban ~j, reported by Shining Phoenix (#0003192).
- Made ./unreal configtest to test config file, suggested by djGrrr (#0003164).
+1
View File
@@ -566,6 +566,7 @@ extern void flag_del(char ch);
extern void init_dynconf(void);
extern char *pretty_time_val(long);
extern int init_conf(char *filename, int rehash);
extern int global_test();
extern void validate_configuration(void);
extern void run_configuration(void);
extern void rehash_motdrules();
+28
View File
@@ -95,6 +95,7 @@ extern MODVAR aMotd *motd;
extern MODVAR aMotd *rules;
extern MODVAR aMotd *botmotd;
extern MODVAR aMotd *smotd;
extern MODVAR ConfigFile *conf;
MODVAR MemoryInfo StatsZ;
int R_do_dns, R_fin_dns, R_fin_dnsc, R_fail_dns, R_do_id, R_fin_id, R_fail_id;
@@ -1282,6 +1283,33 @@ int InitwIRCD(int argc, char *argv[])
# endif
exit(0);
#endif
case 'e':
if (load_conf(configfile) > 0)
{
if (!global_test())
{
config_error("IRCd configuration failed to pass testing");
#ifdef _WIN32
win_error();
#endif
}
else
config_status("Configuration tested without any problems ..");
#ifndef STATIC_LINKING
Unload_all_testing_modules();
#endif
unload_notloaded_includes();
config_free(conf);
conf = NULL;
}
else
{
config_error("IRCd configuration failed to load");
#ifdef _WIN32
win_error();
#endif
}
exit(0);
default:
bad_command();
break;
+8 -4
View File
@@ -1432,7 +1432,13 @@ void applymeblock(void)
}
}
}
int global_test()
{
charsys_reset_pretest();
if ((config_test() < 0) || (callbacks_check() < 0) || (efunctions_check() < 0) || (charsys_postconftest() < 0))
return 0;
return 1;
}
int init_conf(char *rootconf, int rehash)
{
config_status("Loading IRCd configuration ..");
@@ -1447,9 +1453,7 @@ int init_conf(char *rootconf, int rehash)
config_setdefaultsettings(&tempiConf);
if (load_conf(rootconf) > 0)
{
charsys_reset_pretest();
if ((config_test() < 0) || (callbacks_check() < 0) || (efunctions_check() < 0) ||
(charsys_postconftest() < 0))
if (!global_test())
{
config_error("IRCd configuration failed to pass testing");
#ifdef _WIN32
+2
View File
@@ -37,6 +37,8 @@ elif [ "$1" = "mkpasswd" ] ; then
@BINDIR@ -P $2 $3
elif [ "$1" = "version" ] ; then
@BINDIR@ -v
elif [ "$1" = "configtest" ] ; then
@BINDIR@ -e
elif [ "$1" = "backtrace" ] ; then
cd @IRCDDIR@