aboutsummaryrefslogtreecommitdiffstats
path: root/src/loader.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/loader.c')
-rw-r--r--src/loader.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/loader.c b/src/loader.c
index 485fb0d..87abd8e 100644
--- a/src/loader.c
+++ b/src/loader.c
@@ -124,10 +124,11 @@ blogc_source_parse_from_file(const char *f, blogc_error_t **err)
b_slist_t*
-blogc_source_parse_from_files(b_slist_t *l, blogc_error_t **err)
+blogc_source_parse_from_files(b_trie_t *conf, b_slist_t *l, blogc_error_t **err)
{
blogc_error_t *tmp_err = NULL;
b_slist_t *rv = NULL;
+ bool first = true;
for (b_slist_t *tmp = l; tmp != NULL; tmp = tmp->next) {
char *f = tmp->data;
@@ -142,6 +143,23 @@ blogc_source_parse_from_files(b_slist_t *l, blogc_error_t **err)
rv = NULL;
break;
}
+ if (first) {
+ const char *val = b_trie_lookup(s, "DATE");
+ if (val != NULL)
+ b_trie_insert(conf, "DATE_FIRST", b_strdup(val));
+ val = b_trie_lookup(s, "FILENAME");
+ if (val != NULL)
+ b_trie_insert(conf, "FILENAME_FIRST", b_strdup(val));
+ first = false;
+ }
+ if (tmp->next == NULL) { // last
+ const char *val = b_trie_lookup(s, "DATE");
+ if (val != NULL)
+ b_trie_insert(conf, "DATE_LAST", b_strdup(val));
+ val = b_trie_lookup(s, "FILENAME");
+ if (val != NULL)
+ b_trie_insert(conf, "FILENAME_LAST", b_strdup(val));
+ }
rv = b_slist_append(rv, s);
}
return rv;