diff options
author | deva <deva> | 2005-06-14 12:29:40 +0000 |
---|---|---|
committer | deva <deva> | 2005-06-14 12:29:40 +0000 |
commit | 430524810e67d3c223a2ab819f45b882b419c45d (patch) | |
tree | 0abb4b2dd3dabc414c755c30e52d0b5022ee8670 /src/miav_config.cc | |
parent | 0836a6e06f86e366017da3b2b2c132b3a4f2c877 (diff) |
Incorporated the use of the Info object everywhere... also using the log functionality.
Diffstat (limited to 'src/miav_config.cc')
-rw-r--r-- | src/miav_config.cc | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/miav_config.cc b/src/miav_config.cc index 2839c5c..f7d56ce 100644 --- a/src/miav_config.cc +++ b/src/miav_config.cc @@ -31,6 +31,9 @@ /* * $Log$ + * Revision 1.10 2005/06/14 12:29:40 deva + * Incorporated the use of the Info object everywhere... also using the log functionality. + * * Revision 1.9 2005/06/09 11:00:03 deva * Added daemon code, and cleaned up using -Wall and -Werror * @@ -46,9 +49,9 @@ MiavConfig *config; -MiavConfig::MiavConfig(char *file, Info *ginfo) +MiavConfig::MiavConfig(char *file, Info *i) { - info = ginfo; + info = i; configs = NULL; filename = string(file); @@ -57,7 +60,8 @@ MiavConfig::MiavConfig(char *file, Info *ginfo) FILE* fp = fopen(file, "r"); if(!fp) { - info->error("Error reading configuration file %s\n", file); + if(info) info->error("Error reading configuration file %s\n", file); + else fprintf(stderr, "Error reading configuration file %s\n", file); return; } fseek(fp, 0, SEEK_END); @@ -91,7 +95,8 @@ MiavConfig::~MiavConfig() */ _cfg *MiavConfig::parseError(char* msg, char* line) { - info->error("Error parsing file %s at line:\n\t%s\n\t%s\n", filename.c_str(), line, msg); + if(info) info->error("Error parsing file %s at line:\n\t%s\n\t%s\n", filename.c_str(), line, msg); + else fprintf(stderr, "Error parsing file %s at line:\n\t%s\n\t%s\n", filename.c_str(), line, msg); return NULL; } @@ -265,6 +270,8 @@ _cfg *MiavConfig::findNode(char* node) if(!strcmp(node, cfg->name->c_str())) return cfg; cfg = cfg->next; } - info->error("Request for nonexisting node \"%s\"!\n", node); + if(info) info->error("Request for nonexisting node \"%s\"!\n", node); + else fprintf(stderr, "Request for nonexisting node \"%s\"!\n", node); + return NULL; } |