diff options
author | Christian Hesse <mail@eworm.de> | 2013-11-05 10:12:26 +0100 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2013-11-05 10:12:26 +0100 |
commit | 06466a8108415c046b5027792ebf183b39cc3c9a (patch) | |
tree | e52a3d5d92a8b29c4e5c7f87f2fcb6c98384089c /pacredir.c | |
parent | 42e4ae3a1ab87040bce5bf32e78fc8ef3c2222f2 (diff) | |
download | paccache-06466a8108415c046b5027792ebf183b39cc3c9a.tar.gz paccache-06466a8108415c046b5027792ebf183b39cc3c9a.tar.zst |
make pacredir work without config file
Diffstat (limited to 'pacredir.c')
-rw-r--r-- | pacredir.c | 86 |
1 files changed, 43 insertions, 43 deletions
@@ -450,55 +450,55 @@ int main(int argc, char ** argv) { /* parse config file */ if ((ini = iniparser_load(CONFIGFILE)) == NULL) { - write_log(stderr, "cannot parse file: " CONFIGFILE "\n"); - return EXIT_FAILURE ; - } + write_log(stderr, "cannot parse file " CONFIGFILE ", continue anyway\n"); + /* continue anyway, there is nothing essential in the config file */ + } else { + /* store interfaces to ignore */ + if ((values = iniparser_getstring(ini, "general:ignore interfaces", NULL)) != NULL) { +# if defined DEBUG + write_log(stdout, "Ignore interface: [%s]\n", values); +# endif + tmp_ignore_interfaces = ignore_interfaces; - /* store interfaces to ignore */ - if ((values = iniparser_getstring(ini, "general:ignore interfaces", NULL)) != NULL) { -# if defined DEBUG - write_log(stdout, "Ignore interface: [%s]\n", values); -# endif - tmp_ignore_interfaces = ignore_interfaces; - - value = strtok(values, DELIMITER); - while (value != NULL) { - tmp_ignore_interfaces->interface = strdup(value); - tmp_ignore_interfaces->next = malloc(sizeof(struct ignore_interfaces)); - tmp_ignore_interfaces = tmp_ignore_interfaces->next; - value = strtok(NULL, DELIMITER); + value = strtok(values, DELIMITER); + while (value != NULL) { + tmp_ignore_interfaces->interface = strdup(value); + tmp_ignore_interfaces->next = malloc(sizeof(struct ignore_interfaces)); + tmp_ignore_interfaces = tmp_ignore_interfaces->next; + value = strtok(NULL, DELIMITER); + } + tmp_ignore_interfaces->interface = NULL; + tmp_ignore_interfaces->next = NULL; } - tmp_ignore_interfaces->interface = NULL; - tmp_ignore_interfaces->next = NULL; - } - - /* add static pacserve hosts */ - if ((values = iniparser_getstring(ini, "general:pacserve hosts", NULL)) != NULL) { -# if defined DEBUG - write_log(stdout, "pacserve hosts: [%s]\n", values); -# endif - value = strtok(values, DELIMITER); - while (value != NULL) { - add_host(value, PACSERVE); - value = strtok(NULL, DELIMITER); + + /* add static pacserve hosts */ + if ((values = iniparser_getstring(ini, "general:pacserve hosts", NULL)) != NULL) { +# if defined DEBUG + write_log(stdout, "pacserve hosts: [%s]\n", values); +# endif + value = strtok(values, DELIMITER); + while (value != NULL) { + add_host(value, PACSERVE); + value = strtok(NULL, DELIMITER); + } } - } - - /* add static pacdbserve hosts */ - if ((values = iniparser_getstring(ini, "general:pacdbserve hosts", NULL)) != NULL) { -# if defined DEBUG - write_log(stdout, "pacdbserve hosts: [%s]\n", values); -# endif - value = strtok(values, DELIMITER); - while (value != NULL) { - add_host(value, PACDBSERVE); - value = strtok(NULL, DELIMITER); + + /* add static pacdbserve hosts */ + if ((values = iniparser_getstring(ini, "general:pacdbserve hosts", NULL)) != NULL) { +# if defined DEBUG + write_log(stdout, "pacdbserve hosts: [%s]\n", values); +# endif + value = strtok(values, DELIMITER); + while (value != NULL) { + add_host(value, PACDBSERVE); + value = strtok(NULL, DELIMITER); + } } + + /* done reading config file, free */ + iniparser_freedict(ini); } - /* done reading config file, free */ - iniparser_freedict(ini); - /* allocate main loop object */ if ((simple_poll = avahi_simple_poll_new()) == NULL) { write_log(stderr, "Failed to create simple poll object.\n"); |