X-Git-Url: http://git.droids-corp.org/?p=libcmdline.git;a=blobdiff_plain;f=src%2Fgenconf%2Fconfnode_strconfig.c;h=40975c8f450fa2945e60cd94c901b1df36cfe30e;hp=c6dbcd21283a5e06540d6d60449bbef7c4ffb996;hb=d8c2f3c983f787ff68e9ef8737804b86dba0a7cf;hpb=bbaad1e5a8537b1226e261ed7a468c1e48fc0851 diff --git a/src/genconf/confnode_strconfig.c b/src/genconf/confnode_strconfig.c index c6dbcd2..40975c8 100644 --- a/src/genconf/confnode_strconfig.c +++ b/src/genconf/confnode_strconfig.c @@ -150,8 +150,24 @@ static const char *confnode_strconfig_get_type_str(const struct confnode *n) /* Print a one-line summary of the node. Used in case of 'ls'. */ static void confnode_strconfig_display_short(const struct confnode *n) { - /* just display prompt */ - printf(" %s\n", n->prompt); +#define STRBUFLEN 10 + char buf[STRBUFLEN]; + + memset(buf, 0, sizeof(buf)); + + buf[0] = '"'; + confnode_get_value(n, &buf[1], STRBUFLEN-1); + if (strlen(buf) == STRBUFLEN-1) { /* buffer full */ + buf[STRBUFLEN-4] = '.'; + buf[STRBUFLEN-3] = '.'; + buf[STRBUFLEN-2] = '\0'; + } + strcat(buf, "\""); + + while (strlen(buf) < sizeof(buf) - 1) + strcat(buf, " "); + + printf("%s %s: %s\n", buf, n->name, n->prompt); } /* register the node type */