29int main(
int argc,
char* argv[]) {
32 n_log(
LOG_ERR,
"Not enough arguments. Use ex_configfile file");
38 n_log(
LOG_ERR,
"Unable to load config file from %s", argv[1]);
42 n_log(
LOG_ERR,
"There were %d errors in %s. Check the logs !", errors, argv[1]);
46 for (
size_t it = 0; it < nb; it++) {
50 n_log(
LOG_INFO,
"check_interval:%s", (value != NULL) ? value :
"NULL");
52 n_log(
LOG_INFO,
"refresh_interval:%s", (value != NULL) ? value :
"NULL");
54 n_log(
LOG_INFO,
"cache_file:%s", (value != NULL) ? value :
"NULL");
56 n_log(
LOG_INFO,
"cache_file_swp:%s", (value != NULL) ? value :
"NULL");
58 n_log(
LOG_INFO,
"cache_refresh_interval:%s", (value != NULL) ? value :
"NULL");
63 for (
size_t it = 0; it < nb; it++) {
67 n_log(
LOG_INFO,
"check_interval:%s", (value != NULL) ? value :
"NULL");
69 n_log(
LOG_INFO,
"refresh_interval:%s", (value != NULL) ? value :
"NULL");
71 n_log(
LOG_INFO,
"cache_file:%s", (value != NULL) ? value :
"NULL");
73 n_log(
LOG_INFO,
"cache_file_swp:%s", (value != NULL) ? value :
"NULL");
75 n_log(
LOG_INFO,
"cache_refresh_interval:%s", (value != NULL) ? value :
"NULL");
80 for (
size_t it = 0; it < nb; it++) {
84 n_log(
LOG_INFO,
"file_id:%s", (value != NULL) ? value :
"NULL");
88 n_log(
LOG_INFO,
"check_interval:%s", (value != NULL) ? value :
"NULL");
90 n_log(
LOG_INFO,
"command:%s", (value != NULL) ? value :
"NULL");
92 n_log(
LOG_INFO,
"command_timeout:%s", (value != NULL) ? value :
"NULL");
97 for (
size_t it = 0; it < nb; it++) {
101 n_log(
LOG_INFO,
"file_id:%s", (value != NULL) ? value :
"NULL");
103 n_log(
LOG_INFO,
"file:%s", (value != NULL) ? value :
"NULL");
105 n_log(
LOG_INFO,
"check_interval:%s", (value != NULL) ? value :
"NULL");
107 n_log(
LOG_INFO,
"command_timeout:%s", (value != NULL) ? value :
"NULL");
109 for (
size_t it1 = 0; it1 < nb_cmd; it1++) {
111 n_log(
LOG_INFO,
"command:%s", (value != NULL) ? value :
"NULL");
116 char *section_name = NULL, *
key = NULL, *val = NULL;
124 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.