11int main(
int argc,
char* argv[]) {
14 n_log(
LOG_ERR,
"Not enough arguments. Use ex_configfile file");
20 n_log(
LOG_ERR,
"Unable to load config file from %s", argv[1]);
24 n_log(
LOG_ERR,
"There were %d errors in %s. Check the logs !", errors, argv[1]);
28 for (
int it = 0; it < nb; it++) {
32 n_log(
LOG_INFO,
"check_interval:%s", (value != NULL) ? value :
"NULL");
34 n_log(
LOG_INFO,
"refresh_interval:%s", (value != NULL) ? value :
"NULL");
36 n_log(
LOG_INFO,
"cache_file:%s", (value != NULL) ? value :
"NULL");
38 n_log(
LOG_INFO,
"cache_file_swp:%s", (value != NULL) ? value :
"NULL");
40 n_log(
LOG_INFO,
"cache_refresh_interval:%s", (value != NULL) ? value :
"NULL");
45 for (
int it = 0; it < nb; it++) {
49 n_log(
LOG_INFO,
"check_interval:%s", (value != NULL) ? value :
"NULL");
51 n_log(
LOG_INFO,
"refresh_interval:%s", (value != NULL) ? value :
"NULL");
53 n_log(
LOG_INFO,
"cache_file:%s", (value != NULL) ? value :
"NULL");
55 n_log(
LOG_INFO,
"cache_file_swp:%s", (value != NULL) ? value :
"NULL");
57 n_log(
LOG_INFO,
"cache_refresh_interval:%s", (value != NULL) ? value :
"NULL");
62 for (
int it = 0; it < nb; it++) {
66 n_log(
LOG_INFO,
"file_id:%s", (value != NULL) ? value :
"NULL");
70 n_log(
LOG_INFO,
"check_interval:%s", (value != NULL) ? value :
"NULL");
72 n_log(
LOG_INFO,
"command:%s", (value != NULL) ? value :
"NULL");
74 n_log(
LOG_INFO,
"command_timeout:%s", (value != NULL) ? value :
"NULL");
79 for (
int it = 0; it < nb; it++) {
83 n_log(
LOG_INFO,
"file_id:%s", (value != NULL) ? value :
"NULL");
87 n_log(
LOG_INFO,
"check_interval:%s", (value != NULL) ? value :
"NULL");
89 n_log(
LOG_INFO,
"command_timeout:%s", (value != NULL) ? value :
"NULL");
91 for (
int it1 = 0; it1 < nb_cmd; it1++) {
93 n_log(
LOG_INFO,
"command:%s", (value != NULL) ? value :
"NULL");
98 char *section_name = NULL, *
key = NULL, *val = NULL;
size_t get_nb_config_file_sections_entries(CONFIG_FILE *cfg_file, char *section_name, size_t section_position, char *entry)
Get the number of config file with section_name.
char * get_config_section_value(CONFIG_FILE *cfg_file, char *section_name, size_t section_position, char *entry, size_t entry_position)
Function to parse sections and get entries values.
#define config_foreach(__config, __section_name, __key, __val)
Foreach elements of CONFIG_FILE macro, i.e config_foreach( config , section , key ,...