From 7b441117455ee5b3bc5e875eb43853ed40835760 Mon Sep 17 00:00:00 2001 From: stskeeps Date: Sun, 24 Dec 2000 15:37:57 +0000 Subject: [PATCH] +- Added the next part of the new config parser, and some even more --- Changes | 2 +- include/struct.h | 10 +++++----- src/s_conf2.c | 36 +++++++++++++++++++++++++++++++++--- 3 files changed, 39 insertions(+), 9 deletions(-) diff --git a/Changes b/Changes index aa5c34677..ba5aa5b7d 100644 --- a/Changes +++ b/Changes @@ -39,4 +39,4 @@ /topic #channel same for +b if not +o or on the channel. Suggested by Sysop_Mars - Fixed a bug where you would receive a double notice when someone does a /who 0 o - Added first part of the new config parser, s_conf2.c -- Added the next part of the new config parser \ No newline at end of file +- Added the next part of the new config parser, and some even more diff --git a/include/struct.h b/include/struct.h index eb1a2d03b..0e90c0400 100644 --- a/include/struct.h +++ b/include/struct.h @@ -913,7 +913,7 @@ struct _configitem { ConfigItem *next; }; -struct _confitem_me { +struct _configitem_me { long flags; ConfigItem *prev; ConfigItem *next; @@ -923,14 +923,14 @@ struct _confitem_me { short numeric; }; -struct _confitem_admin { +struct _configitem_admin { long flags; ConfigItem *prev; ConfigItem *next; char *line; }; -struct _confitem_class { +struct _configitem_class { long flags; ConfigItem *prev; ConfigItem *next; @@ -940,7 +940,7 @@ struct _confitem_class { int sendq; }; -struct _confitem_allow { +struct _configitem_allow { long flags; ConfigItem *prev; ConfigItem *next; @@ -949,7 +949,7 @@ struct _confitem_allow { ConfigItem_class *class; }; -struct _confitem_oper { +struct _configitem_oper { long flags; ConfigItem *prev; ConfigItem *next; diff --git a/src/s_conf2.c b/src/s_conf2.c index 8a395d9f0..885bc43d0 100644 --- a/src/s_conf2.c +++ b/src/s_conf2.c @@ -67,9 +67,16 @@ static ConfigFile *config_parse(char *filename, char *confdata); static void config_entry_free(ConfigEntry *ceptr); int ConfigParse(ConfigFile *cfptr); - ConfigItem_me *conf_me = NULL; +void *MyMallocEx(size_t size) +{ + void *p = MyMalloc(size); + + bzero(p, size); + return (p); +} + void add_ConfigItem(ConfigItem *item, ConfigItem **list) { item->next = *list; @@ -584,7 +591,11 @@ int _conf_admin(ConfigFile *conf, ConfigEntry *ce) int _conf_me(ConfigFile *conf, ConfigEntry *ce) { ConfigEntry *cep; - + + if (!conf_me) + { + conf_me = (ConfigItem_me *) MyMallocEx(sizeof(ConfigItem_me)); + } for (cep = ce->ce_entries; cep; cep = cep->ce_next) { if (!cep->ce_varname) @@ -594,7 +605,26 @@ int _conf_me(ConfigFile *conf, ConfigEntry *ce) } config_status("[me] Set %s to %s", cep->ce_varname, cep->ce_vardata); - } + if (!strcmp(cep->ce_varname, "name")) + { + if (conf_me->name) + MyFree(conf_me->name); + conf_me->name = strdup(cep->ce_vardata); + config_status("Set me->name to %s :)", conf_me->name); + } else + if (!strcmp(cep->ce_varname, "info")) + { + if (conf_me->info) + MyFree(conf_me->info); + conf_me->info = strdup(cep->ce_vardata); + config_status("Set me->info to %s :)", conf_me->info); + } else + if (!strcmp(cep->ce_varname, "numeric")) + { + conf_me->numeric = atol(cep->ce_vardata); + config_status("Set me->numeric to %i (i) :))", conf_me->numeric); + } + } } int _conf_oper(ConfigFile *conf, ConfigEntry *ce)