1 |
commit: 453d13296d84472e6317472c2b27015b3ca612c4 |
2 |
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Nov 19 07:43:25 2011 +0000 |
4 |
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Nov 19 07:43:25 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=453d1329 |
7 |
|
8 |
rc: usage: do not output non-printable short options in usage |
9 |
|
10 |
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org> |
11 |
|
12 |
--- |
13 |
src/rc/_usage.c | 7 +++++-- |
14 |
1 files changed, 5 insertions(+), 2 deletions(-) |
15 |
|
16 |
diff --git a/src/rc/_usage.c b/src/rc/_usage.c |
17 |
index 8aa1806..96c2d1a 100644 |
18 |
--- a/src/rc/_usage.c |
19 |
+++ b/src/rc/_usage.c |
20 |
@@ -24,6 +24,7 @@ |
21 |
*/ |
22 |
|
23 |
#include "version.h" |
24 |
+#include <ctype.h> |
25 |
|
26 |
#if lint |
27 |
# define _noreturn |
28 |
@@ -59,6 +60,7 @@ usage(int exit_status) |
29 |
char *lo; |
30 |
char *p; |
31 |
char *token; |
32 |
+ char val[4] = "-?,"; |
33 |
|
34 |
#ifdef usagestring |
35 |
printf(usagestring); |
36 |
@@ -70,8 +72,9 @@ usage(int exit_status) |
37 |
#endif |
38 |
printf("\n\nOptions: [" getoptstring "]\n"); |
39 |
for (i = 0; longopts[i].name; ++i) { |
40 |
- len = printf(" -%c, --%s %s", longopts[i].val, longopts[i].name, |
41 |
- has_arg[longopts[i].has_arg]); |
42 |
+ val[1] = longopts[i].val; |
43 |
+ len = printf(" %3s --%s %s", isprint(longopts[i].val) ? val : "", |
44 |
+ longopts[i].name, has_arg[longopts[i].has_arg]); |
45 |
|
46 |
lo = p = xstrdup(longopts_help[i]); |
47 |
while ((token = strsep(&p, "\n"))) { |