aboutsummaryrefslogtreecommitdiff
path: root/src/rc
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2011-11-19 02:43:25 -0500
committerMike Frysinger <vapier@gentoo.org>2011-11-19 02:43:25 -0500
commit453d13296d84472e6317472c2b27015b3ca612c4 (patch)
tree0081ca1439b626e5425a9cfe954b6dc13d816eac /src/rc
parentc21c1f1e59a9e1fe8dbab22ebbf3f574a591e6ba (diff)
rc: usage: do not output non-printable short options in usage
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'src/rc')
-rw-r--r--src/rc/_usage.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/rc/_usage.c b/src/rc/_usage.c
index 8aa1806c..96c2d1a1 100644
--- a/src/rc/_usage.c
+++ b/src/rc/_usage.c
@@ -24,6 +24,7 @@
*/
#include "version.h"
+#include <ctype.h>
#if lint
# define _noreturn
@@ -59,6 +60,7 @@ usage(int exit_status)
char *lo;
char *p;
char *token;
+ char val[4] = "-?,";
#ifdef usagestring
printf(usagestring);
@@ -70,8 +72,9 @@ usage(int exit_status)
#endif
printf("\n\nOptions: [" getoptstring "]\n");
for (i = 0; longopts[i].name; ++i) {
- len = printf(" -%c, --%s %s", longopts[i].val, longopts[i].name,
- has_arg[longopts[i].has_arg]);
+ val[1] = longopts[i].val;
+ len = printf(" %3s --%s %s", isprint(longopts[i].val) ? val : "",
+ longopts[i].name, has_arg[longopts[i].has_arg]);
lo = p = xstrdup(longopts_help[i]);
while ((token = strsep(&p, "\n"))) {