summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--popt.c4
-rw-r--r--popthelp.c4
2 files changed, 5 insertions, 3 deletions
diff --git a/popt.c b/popt.c
index 8e2523c..427d46d 100644
--- a/popt.c
+++ b/popt.c
@@ -908,8 +908,8 @@ static unsigned int poptArgInfo(poptContext con, const struct poptOption * opt)
while (*longName == '-') longName++;
if (longName[0] != opt->longName[0] || longName[1] != opt->longName[1])
{
- if (LF_ISSET(XOR)) /* XXX don't toggle with XOR */
-' ;
+ if (LF_ISSET(XOR)) /* XXX dont toggle with XOR */
+ ;
else {
/* Toggle POPT_BIT_SET <=> POPT_BIT_CLR. */
if (LF_ISSET(LOGICALOPS))
diff --git a/popthelp.c b/popthelp.c
index fffabd0..fe73b6d 100644
--- a/popthelp.c
+++ b/popthelp.c
@@ -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