]> Pileus Git - lackey/commitdiff
Support multiple wildcard matches
authorAndy Spencer <andy753421@gmail.com>
Thu, 25 Dec 2014 00:31:25 +0000 (00:31 +0000)
committerAndy Spencer <andy753421@gmail.com>
Thu, 25 Dec 2014 00:31:25 +0000 (00:31 +0000)
cals/ical.c

index 981d08dc3b29c6951c71c812f0a5e978722d193b..52ffc500017b1cb07fc5c69ea15859a7459e894e 100644 (file)
@@ -152,17 +152,16 @@ static void read_icals(void)
                if (cal->comp == NULL && cal->location) {
                        wordexp_t wexp;
                        wordexp(cal->location, &wexp, WRDE_NOCMD);
-                       if (wexp.we_wordc == 0)
-                               continue;
-                       FILE *file = fopen(wexp.we_wordv[0], "r");
-                       wordfree(&wexp);
-                       if (!file)
-                               continue;
-
                        icalparser *parser = icalparser_new();
-                       icalparser_set_gen_data(parser, file);
+                       for (int i = 0; i < wexp.we_wordc; i++) {
+                               FILE *file = fopen(wexp.we_wordv[i], "r");
+                               if (!file)
+                                       continue;
+                               icalparser_set_gen_data(parser, file);
+                       }
                        cal->comp = icalparser_parse(parser, (void*)fgets);
                        icalparser_free(parser);
+                       wordfree(&wexp);
                }
        }
 }