29 lines
733 B
C
29 lines
733 B
C
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
#include <config.h>
|
|
#include <libconfig.h>
|
|
#include <logging.h>
|
|
|
|
|
|
|
|
bool verbose = false;
|
|
bool debug = false;
|
|
|
|
|
|
int initConfig(const char *configFilename, t_configHandle *configHandle) {
|
|
config_init(&(configHandle->cfg));
|
|
if (! config_read_file(&(configHandle->cfg), configFilename)) {
|
|
logmsg(LOG_ERR, "failed to read config file: %s:%d - %s\n",
|
|
config_error_file(&(configHandle->cfg)), config_error_line(&(configHandle->cfg)),
|
|
config_error_text(&(configHandle->cfg)));
|
|
config_destroy(&(configHandle->cfg));
|
|
return -1;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
void deinitConfig(t_configHandle *configHandle) {
|
|
config_destroy(&(configHandle->cfg));
|
|
}
|