summaryrefslogtreecommitdiff
path: root/popthelp.c
diff options
context:
space:
mode:
authorjbj <jbj>2008-03-08 03:47:53 +0000
committerjbj <jbj>2008-03-08 03:47:53 +0000
commit04f0481b2d1156e28fff2a8039dac6befa6dacb5 (patch)
tree20da4d0de22ea683e1e2ddcac966c2589b8a9973 /popthelp.c
parentffea059a0fac440e81c45018531351983e84c287 (diff)
downloadlibpopt-04f0481b2d1156e28fff2a8039dac6befa6dacb5.tar.gz
- jbj: make sure that short options are printed only once with --usage.
Diffstat (limited to 'popthelp.c')
-rw-r--r--popthelp.c5
1 files changed, 3 insertions, 2 deletions
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 */