diff options
author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2015-05-09 01:23:33 -0300 |
---|---|---|
committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2015-05-09 01:23:33 -0300 |
commit | c266bd93852b156b1436e203bb0f691139274f3d (patch) | |
tree | 3f549cce5aeb4e6273981b131c3cc9ae0e4883cd /src/loader.c | |
parent | 0a63da7081bd1227c5788000349cf7ac03f8e107 (diff) | |
download | blogc-c266bd93852b156b1436e203bb0f691139274f3d.tar.gz blogc-c266bd93852b156b1436e203bb0f691139274f3d.tar.bz2 blogc-c266bd93852b156b1436e203bb0f691139274f3d.zip |
added global variables with date/filename on first and last post
Diffstat (limited to 'src/loader.c')
-rw-r--r-- | src/loader.c | 20 |
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; |