From 16aeeeb8110893e14c2d134542981cdc0f257411 Mon Sep 17 00:00:00 2001 From: deva Date: Tue, 3 May 2005 08:31:58 +0000 Subject: Removed the error object, and replaced it with a more generic info object. --- src/miav_config.cc | 51 +++++++++++++++++++++++++-------------------------- 1 file changed, 25 insertions(+), 26 deletions(-) (limited to 'src/miav_config.cc') diff --git a/src/miav_config.cc b/src/miav_config.cc index 9a209ba..9a6233b 100644 --- a/src/miav_config.cc +++ b/src/miav_config.cc @@ -6,38 +6,46 @@ * Copyright 2005 Bent Bisballe * deva@aasimon.org ****************************************************************************/ + /* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of MIaV. + * + * MIaV is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. + * MIaV is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License + * along with MIaV; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ + /* * $Id$ */ + /* * $Log$ + * Revision 1.8 2005/05/03 08:31:59 deva + * Removed the error object, and replaced it with a more generic info object. + * * Revision 1.7 2005/05/01 09:56:26 deva * Added Id and Log tags to all files - * */ + #include #include "miav_config.h" MiavConfig *config; -MiavConfig::MiavConfig(char *file, Error* err) +MiavConfig::MiavConfig(char *file, Info *ginfo) { - error = err; + info = ginfo; configs = NULL; filename = string(file); @@ -46,9 +54,7 @@ MiavConfig::MiavConfig(char *file, Error* err) FILE* fp = fopen(file, "r"); if(!fp) { - char errbuf[256]; - sprintf(errbuf, "Error reading configuration file %s\n", file); - if(error) error->pushError(errbuf); + info->error("Error reading configuration file %s\n", file); return; } fseek(fp, 0, SEEK_END); @@ -83,8 +89,7 @@ MiavConfig::~MiavConfig() _cfg *MiavConfig::parseError(char* msg, char* line) { char errbuf[512]; - sprintf(errbuf, "Error parsing file %s at line:\n\t%s\n\t%s\n", filename.c_str(), line, msg); - if(error) error->pushError(errbuf); + info->error("Error parsing file %s at line:\n\t%s\n\t%s\n", filename.c_str(), line, msg); return NULL; } @@ -259,12 +264,6 @@ _cfg *MiavConfig::findNode(char* node) cfg = cfg->next; } char errbuf[256]; - sprintf(errbuf, "Request for nonexisting node \"%s\"!\n", node); - if(error) error->pushError(errbuf); + info->error("Request for nonexisting node \"%s\"!\n", node); return NULL; } - -Error* MiavConfig::getErrorObj() -{ - return error; -} -- cgit v1.2.3