rc: usage: do not output non-printable short options in usage
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
This commit is contained in:
parent
c21c1f1e59
commit
453d13296d
@ -24,6 +24,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#if lint
|
#if lint
|
||||||
# define _noreturn
|
# define _noreturn
|
||||||
@ -59,6 +60,7 @@ usage(int exit_status)
|
|||||||
char *lo;
|
char *lo;
|
||||||
char *p;
|
char *p;
|
||||||
char *token;
|
char *token;
|
||||||
|
char val[4] = "-?,";
|
||||||
|
|
||||||
#ifdef usagestring
|
#ifdef usagestring
|
||||||
printf(usagestring);
|
printf(usagestring);
|
||||||
@ -70,8 +72,9 @@ usage(int exit_status)
|
|||||||
#endif
|
#endif
|
||||||
printf("\n\nOptions: [" getoptstring "]\n");
|
printf("\n\nOptions: [" getoptstring "]\n");
|
||||||
for (i = 0; longopts[i].name; ++i) {
|
for (i = 0; longopts[i].name; ++i) {
|
||||||
len = printf(" -%c, --%s %s", longopts[i].val, longopts[i].name,
|
val[1] = longopts[i].val;
|
||||||
has_arg[longopts[i].has_arg]);
|
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]);
|
lo = p = xstrdup(longopts_help[i]);
|
||||||
while ((token = strsep(&p, "\n"))) {
|
while ((token = strsep(&p, "\n"))) {
|
||||||
|
Loading…
Reference in New Issue
Block a user