From: Olivier Matz Date: Fri, 24 Dec 2010 12:10:13 +0000 (+0100) Subject: genconf: fix path display (no slash at the end) X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=bbaad1e5a8537b1226e261ed7a468c1e48fc0851;p=libcmdline.git genconf: fix path display (no slash at the end) Signed-off-by: Olivier Matz --- diff --git a/src/genconf/confnode.c b/src/genconf/confnode.c index 3af3cd3..6a85953 100644 --- a/src/genconf/confnode.c +++ b/src/genconf/confnode.c @@ -468,21 +468,21 @@ void confnode_display_long(const struct confnode *n) confnode_check_deps(n, 1); } -void __conf_display_path(const struct confnode *n) +static void __conf_display_path(const struct confnode *n, int first) { if (n->parent) - __conf_display_path(n->parent); + __conf_display_path(n->parent, 0); if (n->flags & CONFNODE_F_IS_ROOT) printf("/"); else if (!(n->flags & CONFNODE_F_INVISIBLE)) - printf("%s/", n->name); + printf("%s%s", n->name, first ? "" : "/" ); } /* show path: used by the 'pwd' command. Nodes like 'if' are * ignored. */ void conf_display_path(const struct confnode *n) { - __conf_display_path(n); + __conf_display_path(n, 1); printf("\n"); }