summaryrefslogtreecommitdiffabout
path: root/src/getopt.m4
authorSergey Poznyakoff <gray@gnu.org.ua>2009-02-07 19:20:34 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2009-02-07 19:20:34 (GMT)
commit0c6bb13d6b5df94417f2878cd5a4aa4ddcd78a39 (patch) (side-by-side diff)
tree3c44562a4e7a695f82c3f07ad3c4cdaee57c2953 /src/getopt.m4
parent6aa446707278de3675e703a1167054f32cc36e9c (diff)
downloadidest-0c6bb13d6b5df94417f2878cd5a4aa4ddcd78a39.tar.gz
idest-0c6bb13d6b5df94417f2878cd5a4aa4ddcd78a39.tar.bz2
Minor fix
* src/getopt.m4: Fix printing optional arguments in help output.
Diffstat (limited to 'src/getopt.m4') (more/less context) (ignore whitespace changes)
-rw-r--r--src/getopt.m425
1 files changed, 10 insertions, 15 deletions
diff --git a/src/getopt.m4 b/src/getopt.m4
index 5dd7494..ac540af 100644
--- a/src/getopt.m4
+++ b/src/getopt.m4
@@ -258,20 +258,7 @@ print_help(void)
n = printf (" %s", opthelp[i].opt);
if (opthelp[i].arg)
{
- char *cb, *ce;
- if (strlen (opthelp[i].opt) == 2)
- {
- if (!opthelp[i].is_optional)
- {
- putchar (' ');
- n++;
- }
- }
- else
- {
- putchar ('=');
- n++;
- }
+ char *cb, *ce, *sep = "";
if (opthelp[i].is_optional)
{
cb = "[";
@@ -279,7 +266,15 @@ print_help(void)
}
else
cb = ce = "";
- n += printf ("%s%s%s", cb, gettext (opthelp[i].arg), ce);
+
+ if (strlen (opthelp[i].opt) == 2)
+ {
+ if (!opthelp[i].is_optional)
+ sep = " ";
+ }
+ else
+ sep = "=";
+ n += printf ("%s%s%s%s", cb, sep, gettext (opthelp[i].arg), ce);
}
if (n >= DESCRCOLUMN)
{

Return to:

Send suggestions and report system problems to the System administrator.