aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2013-11-05 10:12:26 +0100
committerGravatar Christian Hesse <mail@eworm.de>2013-11-05 10:12:26 +0100
commit06466a8108415c046b5027792ebf183b39cc3c9a (patch)
treee52a3d5d92a8b29c4e5c7f87f2fcb6c98384089c
parent42e4ae3a1ab87040bce5bf32e78fc8ef3c2222f2 (diff)
downloadpacredir-06466a8108415c046b5027792ebf183b39cc3c9a.tar.gz
pacredir-06466a8108415c046b5027792ebf183b39cc3c9a.tar.zst
make pacredir work without config file
-rw-r--r--pacredir.c86
1 files changed, 43 insertions, 43 deletions
diff --git a/pacredir.c b/pacredir.c
index 6a622a0..4ddf9e8 100644
--- a/pacredir.c
+++ b/pacredir.c
@@ -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");