aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/blogc/loader.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/blogc/loader.c b/src/blogc/loader.c
index a9a660e..881661b 100644
--- a/src/blogc/loader.c
+++ b/src/blogc/loader.c
@@ -103,6 +103,17 @@ blogc_source_parse_from_files(bc_trie_t *conf, bc_slist_t *l, bc_error_t **err)
if (err == NULL || *err != NULL)
return NULL;
+ bool reverse = bc_trie_lookup(conf, "FILTER_REVERSE");
+ bc_slist_t* sources = NULL;
+ for (bc_slist_t *tmp = l; tmp != NULL; tmp = tmp->next) {
+ if (reverse) {
+ sources = bc_slist_prepend(sources, tmp->data);
+ }
+ else {
+ sources = bc_slist_append(sources, tmp->data);
+ }
+ }
+
bc_error_t *tmp_err = NULL;
bc_slist_t *rv = NULL;
unsigned int with_date = 0;
@@ -135,7 +146,7 @@ blogc_source_parse_from_files(bc_trie_t *conf, bc_slist_t *l, bc_error_t **err)
unsigned int end = start + per_page;
unsigned int counter = 0;
- for (bc_slist_t *tmp = l; tmp != NULL; tmp = tmp->next) {
+ for (bc_slist_t *tmp = sources; tmp != NULL; tmp = tmp->next) {
char *f = tmp->data;
bc_trie_t *s = blogc_source_parse_from_file(f, &tmp_err);
if (s == NULL) {
@@ -182,6 +193,8 @@ blogc_source_parse_from_files(bc_trie_t *conf, bc_slist_t *l, bc_error_t **err)
rv = bc_slist_append(rv, s);
}
+ bc_slist_free(sources);
+
if (with_date > 0 && with_date < bc_slist_length(rv)) {
*err = bc_error_new_printf(BLOGC_ERROR_LOADER,
"'DATE' variable provided for at least one source file, but not "