diff options
author | jbj <jbj> | 2009-01-21 20:14:26 +0000 |
---|---|---|
committer | jbj <jbj> | 2009-01-21 20:14:26 +0000 |
commit | 529e1866845a7dc24b29b2b8193fd90793555446 (patch) | |
tree | 85df0197f61cec12cd4cec501d7ac336ac94bd77 /popthelp.c | |
parent | 3117c302da9fe0c860c65c32e0cc4c16df840373 (diff) | |
download | libpopt-529e1866845a7dc24b29b2b8193fd90793555446.tar.gz |
- jbj: fix typo, display toggled long options as "--[no]foo" with --help.
Diffstat (limited to 'popthelp.c')
-rw-r--r-- | popthelp.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -322,6 +322,7 @@ static void singleOptionHelp(FILE * fp, columns_t columns, /* Make sure there's more than enough room in target buffer. */ if (opt->longName) nb += strlen(opt->longName); + if (F_ISSET(opt, TOGGLE)) nb += sizeof("[no]") - 1; if (argDescrip) nb += strlen(argDescrip); left = malloc(nb); @@ -345,7 +346,8 @@ static void singleOptionHelp(FILE * fp, columns_t columns, /* XXX --long always padded for alignment with/without "-X, ". */ char *dash = poptArgType(opt) == POPT_ARG_MAINCALL ? "" : (F_ISSET(opt, ONEDASH) ? "-" : "--"); - (void) stpcpy(stpcpy(stpcpy(left, " "), dash), opt->longName); + char *toggle = (F_ISSET(opt, TOGGLE) ? "[no]" : ""); + (void) stpcpy(stpcpy(stpcpy(stpcpy(left, " "), dash), toggle), opt->longName); } #undef prtlong |