make config structure pointer global
This commit is contained in:
parent
4aa37602ec
commit
cacb7c46e3
2
yasnd.c
2
yasnd.c
@ -22,6 +22,7 @@ typedef struct {
|
|||||||
int fail_count; // how many times in a row host was unreachable
|
int fail_count; // how many times in a row host was unreachable
|
||||||
} host_decl;
|
} host_decl;
|
||||||
|
|
||||||
|
cfg_t *cfg; // pointer to configuration structure
|
||||||
host_decl* hosts=NULL; // structure with hosts' definitions
|
host_decl* hosts=NULL; // structure with hosts' definitions
|
||||||
int hosts_count=0; // count of hosts
|
int hosts_count=0; // count of hosts
|
||||||
int debug_flag=0;
|
int debug_flag=0;
|
||||||
@ -55,7 +56,6 @@ void init()
|
|||||||
CFG_SIMPLE_INT("debug", &debug_flag),
|
CFG_SIMPLE_INT("debug", &debug_flag),
|
||||||
CFG_END()
|
CFG_END()
|
||||||
};
|
};
|
||||||
cfg_t *cfg;
|
|
||||||
cfg = cfg_init(opts, CFGF_NONE);
|
cfg = cfg_init(opts, CFGF_NONE);
|
||||||
// check if config file is valid and parse it
|
// check if config file is valid and parse it
|
||||||
if (cfg_parse(cfg, "/etc/yasnd.conf") == CFG_PARSE_ERROR)
|
if (cfg_parse(cfg, "/etc/yasnd.conf") == CFG_PARSE_ERROR)
|
||||||
|
Loading…
Reference in New Issue
Block a user