+static void read_icals(void)
+{
+ for (ical_t *cal = calendars; cal; cal = cal->next) {
+ if (cal->ical == 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);
+ cal->ical = icalparser_parse(parser, (void*)fgets);
+ icalparser_free(parser);
+ }
+ }
+}
+