From 04f0481b2d1156e28fff2a8039dac6befa6dacb5 Mon Sep 17 00:00:00 2001 From: jbj Date: Sat, 8 Mar 2008 03:47:53 +0000 Subject: - jbj: make sure that short options are printed only once with --usage. --- popthelp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'popthelp.c') diff --git a/popthelp.c b/popthelp.c index a1e0c13..0de5e6a 100644 --- a/popthelp.c +++ b/popthelp.c @@ -845,8 +845,9 @@ static size_t showShortOptions(const struct poptOption * opt, FILE * fp, for (; (opt->longName || opt->shortName || opt->arg); opt++) { if (!F_ISSET(opt, DOC_HIDDEN) && opt->shortName && !poptArgType(opt)) { - /* Display shortName iff printable non-space. */ - if (isprint((int)opt->shortName) && opt->shortName != ' ') + /* Display shortName iff unique printable non-space. */ + if (!strchr(s, opt->shortName) && isprint((int)opt->shortName) + && opt->shortName != ' ') s[strlen(s)] = opt->shortName; } else if (poptArgType(opt) == POPT_ARG_INCLUDE_TABLE) if (opt->arg) /* XXX program error */ -- cgit v1.2.1