30int main(
int argc,
char* argv[]) {
33 n_log(
LOG_ERR,
"Not enough arguments. Use ex_configfile file");
39 n_log(
LOG_ERR,
"Unable to load config file from %s", argv[1]);
43 n_log(
LOG_ERR,
"There were %d errors in %s. Check the logs !", errors, argv[1]);
47 for (
size_t it = 0; it < nb; it++) {
51 n_log(
LOG_INFO,
"check_interval:%s", (value != NULL) ? value :
"NULL");
53 n_log(
LOG_INFO,
"refresh_interval:%s", (value != NULL) ? value :
"NULL");
55 n_log(
LOG_INFO,
"cache_file:%s", (value != NULL) ? value :
"NULL");
57 n_log(
LOG_INFO,
"cache_file_swp:%s", (value != NULL) ? value :
"NULL");
59 n_log(
LOG_INFO,
"cache_refresh_interval:%s", (value != NULL) ? value :
"NULL");
64 for (
size_t it = 0; it < nb; it++) {
68 n_log(
LOG_INFO,
"check_interval:%s", (value != NULL) ? value :
"NULL");
70 n_log(
LOG_INFO,
"refresh_interval:%s", (value != NULL) ? value :
"NULL");
72 n_log(
LOG_INFO,
"cache_file:%s", (value != NULL) ? value :
"NULL");
74 n_log(
LOG_INFO,
"cache_file_swp:%s", (value != NULL) ? value :
"NULL");
76 n_log(
LOG_INFO,
"cache_refresh_interval:%s", (value != NULL) ? value :
"NULL");
81 for (
size_t it = 0; it < nb; it++) {
85 n_log(
LOG_INFO,
"file_id:%s", (value != NULL) ? value :
"NULL");
89 n_log(
LOG_INFO,
"check_interval:%s", (value != NULL) ? value :
"NULL");
91 n_log(
LOG_INFO,
"command:%s", (value != NULL) ? value :
"NULL");
93 n_log(
LOG_INFO,
"command_timeout:%s", (value != NULL) ? value :
"NULL");
98 for (
size_t it = 0; it < nb; it++) {
102 n_log(
LOG_INFO,
"file_id:%s", (value != NULL) ? value :
"NULL");
104 n_log(
LOG_INFO,
"file:%s", (value != NULL) ? value :
"NULL");
106 n_log(
LOG_INFO,
"check_interval:%s", (value != NULL) ? value :
"NULL");
108 n_log(
LOG_INFO,
"command_timeout:%s", (value != NULL) ? value :
"NULL");
110 for (
size_t it1 = 0; it1 < nb_cmd; it1++) {
112 n_log(
LOG_INFO,
"command:%s", (value != NULL) ? value :
"NULL");
117 char *section_name = NULL, *
key = NULL, *val = NULL;
125 n_log(
LOG_INFO,
"write_config_file: written to nilorea_ex_configfile_out.cfg");
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 ,...
size_t get_nb_config_file_sections_entries(CONFIG_FILE *cfg_file, const char *section_name, size_t section_position, char *entry)
Get the number of config file with section_name.