summaryrefslogtreecommitdiff
path: root/src/miav_config.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/miav_config.cc')
-rw-r--r--src/miav_config.cc25
1 files changed, 7 insertions, 18 deletions
diff --git a/src/miav_config.cc b/src/miav_config.cc
index d20055f..cd464f9 100644
--- a/src/miav_config.cc
+++ b/src/miav_config.cc
@@ -24,23 +24,22 @@
* along with MIaV; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-#include <config.h>
#include "miav_config.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
+#include <hugin.hpp>
+
MiavConfig *config;
MiavConfig::MiavConfig()
{
- info = NULL;
}
-MiavConfig::MiavConfig(const char *file, Info *i)
+MiavConfig::MiavConfig(const char *file)
{
- info = i;
configs = NULL;
filename = string(file);
@@ -49,8 +48,7 @@ MiavConfig::MiavConfig(const char *file, Info *i)
FILE* fp = fopen(file, "r");
if(!fp) {
- if(info) info->error("Error reading configuration file %s\n", file);
- else fprintf(stderr, "Error reading configuration file %s\n", file);
+ ERR(config, "Error reading configuration file %s\n", file);
return;
}
fseek(fp, 0, SEEK_END);
@@ -85,16 +83,8 @@ MiavConfig::~MiavConfig()
*/
void MiavConfig::parseError(const char* msg, _cfg* cfg)
{
- if(info) info->error("Error parsing file %s at line %d:\n\t%s\n\t%s\n",
- filename.c_str(),
- cfg->line,
- cfg->orig,
- msg);
- else fprintf(stderr, "Error parsing file %s at line %d:\n\t%s\n\t%s\n",
- filename.c_str(),
- cfg->line,
- cfg->orig,
- msg);
+ ERR(config, "Error parsing file %s at line %d:\n\t%s\n\t%s\n",
+ filename.c_str(), cfg->line, cfg->orig, msg);
}
_cfg* MiavConfig::readLines(char* raw)
@@ -471,8 +461,7 @@ _cfg *MiavConfig::findNode(const char* node)
if(!strcmp(node, cfg->name->c_str())) return cfg;
cfg = cfg->next;
}
- if(info) info->error("Missing line in configuration file: \"%s\"!\n", node);
- else fprintf(stderr, "Missing line in configuration file: \"%s\"!\n", node);
+ ERR(config, "Missing line in configuration file: \"%s\"!\n", node);
return NULL;
}