aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2019-04-13 19:46:39 +0200
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2019-04-13 19:46:39 +0200
commit64a808bb68b88605090577e296150320cb7af18a (patch)
tree07a7ae9e983b4f62a558becf2a913788148a4407 /src
parent0a79af2e17386d60a06172d72b50d9196d0fcb28 (diff)
downloadblogc-64a808bb68b88605090577e296150320cb7af18a.tar.gz
blogc-64a808bb68b88605090577e296150320cb7af18a.tar.bz2
blogc-64a808bb68b88605090577e296150320cb7af18a.zip
blogc: added support for formatted variables in -p
Diffstat (limited to 'src')
-rw-r--r--src/blogc/main.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/blogc/main.c b/src/blogc/main.c
index 5a4df99..2f93d18 100644
--- a/src/blogc/main.c
+++ b/src/blogc/main.c
@@ -315,13 +315,11 @@ main(int argc, char **argv)
}
if (print != NULL) {
- const char *val = NULL;
+ bc_trie_t *local = NULL;
if (!listing && s != NULL) {
- val = bc_trie_lookup(s->data, print);
- }
- if (val == NULL) {
- val = bc_trie_lookup(config, print);
+ local = s->data;
}
+ char *val = blogc_format_variable(print, config, local, NULL);
if (val == NULL) {
fprintf(stderr, "blogc: error: variable not found: %s\n",
print);
@@ -330,6 +328,7 @@ main(int argc, char **argv)
else {
printf("%s\n", val);
}
+ free(val);
goto cleanup2;
}