display whether an option takes an argument in the usage output
This commit is contained in:
parent
8ce7911f10
commit
7d9acd968f
11
src/_usage.c
11
src/_usage.c
@ -9,15 +9,20 @@
|
|||||||
|
|
||||||
static void usage (int exit_status)
|
static void usage (int exit_status)
|
||||||
{
|
{
|
||||||
|
const char * const has_arg[] = { "", "<arg>", "[arg]" };
|
||||||
int i;
|
int i;
|
||||||
printf ("Usage: " APPLET " [options] ");
|
printf ("Usage: " APPLET " [options] ");
|
||||||
#ifdef extraopts
|
#ifdef extraopts
|
||||||
printf (extraopts);
|
printf (extraopts);
|
||||||
#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) {
|
||||||
printf (" -%c, --%-15s %s\n", longopts[i].val, longopts[i].name,
|
int len = printf (" -%c, --%s %s", longopts[i].val, longopts[i].name,
|
||||||
longopts_help[i]);
|
has_arg[longopts[i].has_arg]);
|
||||||
|
while (++len < 25)
|
||||||
|
printf (" ");
|
||||||
|
puts (longopts_help[i]);
|
||||||
|
}
|
||||||
exit (exit_status);
|
exit (exit_status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user