#include <netinet/in.h>
#include <libconfig.h>
-#include "AppConfiguration.h"
#define GPATH "loggr"
#define IPATH "logi"
exit(3);
}
/* File exists, so file has been locked. Release it. */
- fclose(file);
config_init(&cfg);
/* Read the file. If there is an error, report it and exit. */
- if(!config_read_file(&cfg, fname))
+ if(!config_read(&cfg, file))
{
- AppConfiguration::error(&cfg);
+ fprintf(stderr, "%s! In file %s, line %d\n",
+ config_error_text(&cfg),
+ config_error_file(&cfg),
+ config_error_line(&cfg));
config_destroy(&cfg);
+ fclose(file);
exit(3);/* from original code. */
}
if(!config_lookup_int(&cfg, "node_number", &NodeNumber))
{
- AppConfiguration::error(&cfg);
+ fprintf(stderr, "%s! In file %s, '%s' was not found.\n",
+ "Warning",
+ fname,
+ "node_number");
config_destroy(&cfg);
+ fclose(file);
exit(3);
}
ConType = (strcmp(str, "explicit") == 0) ? 1 : 2;
}
else {
- AppConfiguration::error(&cfg);
+ fprintf(stderr, "%s! In file %s, '%s' was not found.\n",
+ "Warning",
+ fname,
+ "type");
}
ConnectList.append(new ConnectEntry((char*)str));
}
else {
- AppConfiguration::error(&cfg);
+ fprintf(stderr, "%s! In file %s, '%s' was not found.\n",
+ "Warning",
+ fname,
+ "host");
}
if(config_lookup_string(&cfg, "progdir", &str)){
strncpy(progdir, str, 256);
}
else {
- AppConfiguration::error(&cfg);
+ fprintf(stderr, "%s! In file %s, '%s' was not found.\n",
+ "Warning",
+ fname,
+ "progdir");
}
if(config_lookup_string(&cfg, "homedir", &str)){
strncpy(HomeDir, str, 255);
}
else {
- AppConfiguration::error(&cfg);
+ fprintf(stderr, "%s! In file %s, '%s' was not found.\n",
+ "Warning",
+ fname,
+ "homedir");
}
config_destroy(&cfg);
+ fclose(file);
}
/* +++++++++++++++++++++++++++++++++++++++++++++++ */