aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2019-03-27 20:58:54 +0100
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2019-03-27 20:58:54 +0100
commitac8e82c3a11f79082e9ed5f5f9c654c8f32b2ebc (patch)
treebbcaf58ac980987495f072e96c40150c2d119f48 /src
parent2bc12dae0b1b0f17b80f79d7eef8e807c5e9341e (diff)
downloadblogc-ac8e82c3a11f79082e9ed5f5f9c654c8f32b2ebc.tar.gz
blogc-ac8e82c3a11f79082e9ed5f5f9c654c8f32b2ebc.tar.bz2
blogc-ac8e82c3a11f79082e9ed5f5f9c654c8f32b2ebc.zip
blogc: dump source file variables as well as global variables
Diffstat (limited to 'src')
-rw-r--r--src/blogc/main.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/blogc/main.c b/src/blogc/main.c
index 0e6bcc9..1ca0e82 100644
--- a/src/blogc/main.c
+++ b/src/blogc/main.c
@@ -60,9 +60,8 @@ blogc_print_help(void)
" -d enable debug\n"
" -i read list of source files from standard input\n"
" -l build listing page, from multiple source files\n"
- " -D KEY=VALUE set global configuration parameter\n"
- " -p KEY show the value of a global configuration parameter\n"
- " after source parsing and exit\n"
+ " -D KEY=VALUE set global variable\n"
+ " -p KEY show the value of a variable after source parsing and exit\n"
" -t TEMPLATE template file\n"
" -o OUTPUT output file\n"
#ifdef MAKE_EMBEDDED
@@ -292,9 +291,15 @@ main(int argc, char **argv)
}
if (print != NULL) {
- const char *val = bc_trie_lookup(config, print);
+ const char *val = NULL;
+ if (!listing && s != NULL) {
+ val = bc_trie_lookup(s->data, print);
+ }
+ if (val == NULL) {
+ val = bc_trie_lookup(config, print);
+ }
if (val == NULL) {
- fprintf(stderr, "blogc: error: configuration variable not found: %s\n",
+ fprintf(stderr, "blogc: error: variable not found: %s\n",
print);
rv = 3;
}