summaryrefslogtreecommitdiff
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
parentffea059a0fac440e81c45018531351983e84c287 (diff)
downloadlibpopt-04f0481b2d1156e28fff2a8039dac6befa6dacb5.tar.gz
- jbj: make sure that short options are printed only once with --usage.
-rw-r--r--CHANGES1
-rw-r--r--popthelp.c5
2 files changed, 4 insertions, 2 deletions
diff --git a/CHANGES b/CHANGES
index 4ccc5df..3ecd969 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,5 @@
1.13 -> 1.14:
+ - jbj: make sure that short options are printed only once with --usage.
- jbj: don't display hidden short options with --usage.
- jbj: updated sv.po (Translation Project).
- jbj: updated {fi,nl}.po (Translation Project).
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 */