From 453d13296d84472e6317472c2b27015b3ca612c4 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 19 Nov 2011 02:43:25 -0500 Subject: rc: usage: do not output non-printable short options in usage Signed-off-by: Mike Frysinger --- src/rc/_usage.c | 7 +++++-- 1 file 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 #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"))) { -- cgit v1.2.3