cmdline: new build system
[libcmdline.git] / src / genconf / confnode_menu.c
index 4eafa4b..844eb32 100644 (file)
@@ -78,6 +78,7 @@ static int confnode_menu_new(struct confnode *n, const struct line *line)
        snprintf(n->name, sizeof(n->name), "%s", tok->str);
        n->ops = &confnode_menu.ops;
        n->flags = CONFNODE_F_IS_DIR;
+       snprintf(n->default_value, sizeof(n->default_value), "y");
        return 0;
 }
 
@@ -106,13 +107,9 @@ static int confnode_menu_close_dir(struct confnode *parent,
 static int confnode_menu_dotconfig_write(const struct confnode *n, FILE *f)
 {
        const struct confnode *c;
-       int val;
 
-       val = confnode_get_value(n, NULL, 0);
-       if (val < 0)
+       if (fprintf(f, "#\n# -- %s\n#\n", n->prompt) < 0)
                return -1;
-       if (val == 0)
-               return 0;
 
        TAILQ_FOREACH(c, &n->children, next) {
                if (confnode_dotconfig_write(c, f) < 0)
@@ -131,7 +128,7 @@ static const char *confnode_menu_get_type_str(const struct confnode *n)
 /* Print a one-line summary of the node. Used in case of 'ls'. */
 static void confnode_menu_display_short(const struct confnode *n)
 {
-       printf("    -> %s: %s\n", n->name, n->prompt);
+       printf("       -> %s: %s\n", n->name, n->prompt);
 }
 
 /* Print a detailed view of the node. */
@@ -141,7 +138,6 @@ static void confnode_menu_display_long(const struct confnode *n)
        printf("    path ");
        conf_display_path(n);
        printf("    \"%s\"\n", n->prompt);
-       printf("    no value\n");
 }
 
 /* register the node type */