diff options
author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2015-05-09 22:12:36 -0300 |
---|---|---|
committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2015-05-09 22:12:36 -0300 |
commit | 0cb80d3050de4adb65b6c4acb4c9ac765b2ae448 (patch) | |
tree | 3197ccb602b56ad9030f37bd959ee8c393921fe0 /src | |
parent | 502ed6760d9d2d674d0dcc87a6cb223ff079745d (diff) | |
download | blogc-0cb80d3050de4adb65b6c4acb4c9ac765b2ae448.tar.gz blogc-0cb80d3050de4adb65b6c4acb4c9ac765b2ae448.tar.bz2 blogc-0cb80d3050de4adb65b6c4acb4c9ac765b2ae448.zip |
raise warning if user provided DATE for one source file, but not for all source files
Diffstat (limited to 'src')
-rw-r--r-- | src/loader.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/loader.c b/src/loader.c index 786fc05..f868aeb 100644 --- a/src/loader.c +++ b/src/loader.c @@ -10,6 +10,7 @@ #include <config.h> #endif /* HAVE_CONFIG_H */ +#include <stdio.h> #include <string.h> #include "utils/utils.h" #include "file.h" @@ -99,6 +100,7 @@ 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; + unsigned int with_date = 0; for (b_slist_t *tmp = l; tmp != NULL; tmp = tmp->next) { char *f = tmp->data; @@ -113,6 +115,8 @@ blogc_source_parse_from_files(b_trie_t *conf, b_slist_t *l, blogc_error_t **err) rv = NULL; break; } + if (b_trie_lookup(s, "DATE")) + with_date++; if (first) { const char *val = b_trie_lookup(s, "DATE"); if (val != NULL) @@ -132,5 +136,11 @@ blogc_source_parse_from_files(b_trie_t *conf, b_slist_t *l, blogc_error_t **err) } rv = b_slist_append(rv, s); } + if (with_date > 0 && with_date < b_slist_length(l)) + // fatal error, maybe? + fprintf(stderr, + "blogc: warning: 'DATE' variable provided for at least one source " + "file, but not for all source files. This means that you may get " + "wrong values for 'DATE_FIRST' and 'DATE_LAST' variables.\n"); return rv; } |