genconf: fix path display (no slash at the end)
authorOlivier Matz <zer0@droids-corp.org>
Fri, 24 Dec 2010 12:10:13 +0000 (13:10 +0100)
committerOlivier Matz <zer0@droids-corp.org>
Sun, 2 Jan 2011 20:53:15 +0000 (21:53 +0100)
Signed-off-by: Olivier Matz <zer0@droids-corp.org>
src/genconf/confnode.c

index 3af3cd3..6a85953 100644 (file)
@@ -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");
 }