/[cvs]/eggdrop1.9/src/core_config.c
ViewVC logotype

Contents of /eggdrop1.9/src/core_config.c

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.15 - (show annotations) (download) (as text)
Mon Mar 1 22:58:33 2004 UTC (16 years, 5 months ago) by stdarg
Branch: MAIN
Changes since 1.14: +2 -2 lines
File MIME type: text/x-chdr
* Fixed some valgrind errors; still a few in xml* though.

1 /* core_config.c: config file
2 *
3 * Copyright (C) 2003, 2004 Eggheads Development Team
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */
19
20 #ifndef lint
21 static const char rcsid[] = "$Id: core_config.c,v 1.14 2004/01/11 12:16:08 wcc Exp $";
22 #endif
23
24 #include <eggdrop/eggdrop.h>
25 #include <string.h>
26 #include "core_config.h"
27
28 extern char *configfile;
29 core_config_t core_config = {0};
30 void *config_root = NULL;
31
32 static config_var_t core_config_vars[] = {
33 /* General bot stuff. */
34 {"botname", &core_config.botname, CONFIG_STRING},
35 {"userfile", &core_config.userfile, CONFIG_STRING},
36
37 /* The owner. */
38 {"owner", &core_config.owner, CONFIG_STRING},
39 {"admin", &core_config.admin, CONFIG_STRING},
40
41 /* Paths. */
42 {"help_path", &core_config.help_path, CONFIG_STRING},
43 {"temp_path", &core_config.temp_path, CONFIG_STRING},
44 {"text_path", &core_config.text_path, CONFIG_STRING},
45 {"module_path", &core_config.module_path, CONFIG_STRING},
46
47 /* Logfile. */
48 {"logfile_suffix", &core_config.logfile_suffix, CONFIG_STRING},
49 {"max_logsize", &core_config.max_logsize, CONFIG_INT},
50 {"switch_logfiles_at", &core_config.switch_logfiles_at, CONFIG_INT},
51 {"keep_all_logs", &core_config.keep_all_logs, CONFIG_INT},
52 {"quick_logs", &core_config.quick_logs, CONFIG_INT},
53
54 /* Whois. */
55 {"whois_items", &core_config.whois_items, CONFIG_STRING},
56
57 /* Other. */
58 {"die_on_sigterm", &core_config.die_on_sigterm, CONFIG_INT},
59 {0}
60 };
61
62 void core_config_init(const char *fname)
63 {
64 /* Set default vals. */
65 memset(&core_config, 0, sizeof(core_config));
66
67 /* Hook the owner variable into libeggdrop. */
68 egg_setowner(&core_config.owner);
69
70 core_config.botname = strdup("eggdrop");
71 core_config.userfile = strdup("users.xml");
72 core_config.help_path = strdup("help/");
73
74 core_config.logfile_suffix = strdup(".%d%b%Y");
75
76 config_root = config_load(fname);
77 config_set_root("eggdrop", config_root);
78 config_link_table(core_config_vars, config_root, "eggdrop", 0, NULL);
79 }
80
81 void core_config_save()
82 {
83 config_update_table(core_config_vars, config_root, "eggdrop", 0, NULL);
84 config_save("eggdrop", configfile);
85 }

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23