src/core_config.c File Reference

#include <eggdrop/eggdrop.h>
#include "core_config.h"

Go to the source code of this file.

Functions

int core_config_init (const char *fname)
int core_config_save (void)

Variables

static const char rcsid [] = "$Id: core_config.c,v 1.24 2004-10-17 05:14:07 stdarg Exp $"
char * configfile
core_config_t core_config = {0}
void * config_root = NULL
static config_var_t core_config_vars []


Function Documentation

int core_config_init ( const char *  fname  ) 

Definition at line 63 of file core_config.c.

References core_config_t::botname, config_link_table(), config_load(), config_root, config_set_root(), config_update_table(), egg_setowner(), core_config_t::help_path, core_config_t::lockfile, core_config_t::logging, NULL, core_config_t::owner, logging_t::suffix, and core_config_t::userfile.

Referenced by core_init().

00064 {
00065   /* Set default vals. */
00066   memset(&core_config, 0, sizeof(core_config));
00067 
00068   /* Hook the owner variable into libeggdrop. */
00069   egg_setowner(&core_config.owner);
00070 
00071   config_root = config_load(fname);
00072   if (config_root == NULL) return -1;
00073 
00074   config_set_root("eggdrop", config_root);
00075   config_link_table(core_config_vars, config_root, "eggdrop", 0, NULL);
00076   if (!core_config.botname) core_config.botname = strdup("eggdrop");
00077   if (!core_config.userfile) core_config.userfile = strdup("users.xml");
00078   if (!core_config.lockfile) core_config.lockfile = strdup("lock");
00079   if (!core_config.help_path) core_config.help_path = strdup("help/");
00080   if (!core_config.logging.suffix) core_config.logging.suffix = strdup(".%d%b%Y");
00081 
00082   config_update_table(core_config_vars, config_root, "eggdrop", 0, NULL);
00083 
00084   return (0);
00085 }

int core_config_save ( void   ) 

Definition at line 87 of file core_config.c.

References config_root, config_save(), config_update_table(), configfile, and NULL.

Referenced by core_shutdown_or_restart(), create_userfile(), and party_save().

00088 {
00089   config_update_table(core_config_vars, config_root, "eggdrop", 0, NULL);
00090 
00091   config_save("eggdrop", configfile);
00092 
00093   return (0);
00094 }


Variable Documentation

void* config_root = NULL

char* configfile

Definition at line 68 of file main.c.

Referenced by core_config_save(), core_init(), do_args(), and main().

Initial value:

 {
  
  {"botname", &core_config.botname, CONFIG_STRING}, 
  {"userfile", &core_config.userfile, CONFIG_STRING}, 
  {"lockfile", &core_config.lockfile, CONFIG_STRING}, 

  
  {"owner", &core_config.owner, CONFIG_STRING},   
  {"admin", &core_config.admin, CONFIG_STRING},   

  
  {"help_path", &core_config.help_path, CONFIG_STRING}, 
  {"temp_path", &core_config.temp_path, CONFIG_STRING}, 
  {"text_path", &core_config.text_path, CONFIG_STRING}, 
  {"module_path", &core_config.module_path, CONFIG_STRING},

  
  {"whois_items", &core_config.whois_items, CONFIG_STRING},

  
  {"logging.keep_all", &core_config.logging.keep_all, CONFIG_INT},
  {"logging.quick", &core_config.logging.quick, CONFIG_INT},
  {"logging.max_size", &core_config.logging.max_size, CONFIG_INT},
  {"logging.switch_at", &core_config.logging.switch_at, CONFIG_INT},
  {"logging.suffix", &core_config.logging.suffix, CONFIG_STRING},

  
  {"die_on_sigterm", &core_config.die_on_sigterm, CONFIG_INT},
  {0}
}

Definition at line 31 of file core_config.c.

const char rcsid[] = "$Id: core_config.c,v 1.24 2004-10-17 05:14:07 stdarg Exp $" [static]

Definition at line 21 of file core_config.c.


Generated on Sun Nov 30 18:43:36 2008 for eggdrop1.9 by  doxygen 1.5.6