diff options
-rw-r--r-- | src/_usage.c | 7 | ||||
-rw-r--r-- | src/checkown.c | 4 | ||||
-rw-r--r-- | src/mountinfo.c | 1 | ||||
-rw-r--r-- | src/rc-status.c | 1 |
4 files changed, 11 insertions, 2 deletions
diff --git a/src/_usage.c b/src/_usage.c index 54e30d96..28f98150 100644 --- a/src/_usage.c +++ b/src/_usage.c @@ -10,8 +10,11 @@ static void usage (int exit_status) { int i; - printf ("Usage: " APPLET " [options]\n\n"); - printf ("Options: [" getoptstring "]\n"); + printf ("Usage: " APPLET " [options] "); +#ifdef extraopts + printf (extraopts); +#endif + printf ("\n\nOptions: [" getoptstring "]\n"); for (i = 0; longopts[i].name; ++i) printf (" -%c, --%s\n", longopts[i].val, longopts[i].name); exit (exit_status); diff --git a/src/checkown.c b/src/checkown.c index 9402b8af..d9294dac 100644 --- a/src/checkown.c +++ b/src/checkown.c @@ -132,6 +132,7 @@ static struct group *get_group (const char *name) } #include "_usage.h" +#define extraopts "dir1 dir2 ..." #define getoptstring "fm:g:u:" getoptstring_COMMON static struct option longopts[] = { { "directory", 0, NULL, 'd'}, @@ -190,6 +191,9 @@ int checkown (int argc, char **argv) } } + if (optind >= argc) + usage (EXIT_FAILURE); + if (pw) { uid = pw->pw_uid; gid = pw->pw_gid; diff --git a/src/mountinfo.c b/src/mountinfo.c index 6ed257a5..c55a942b 100644 --- a/src/mountinfo.c +++ b/src/mountinfo.c @@ -246,6 +246,7 @@ static regex_t *get_regex (char *string) } #include "_usage.h" +#define extraopts "[mount1] [mount2] ..." #define getoptstring "f:F:n:N:o:O:p:P:iqst" getoptstring_COMMON static struct option longopts[] = { { "fstype-regex", 1, NULL, 'f'}, diff --git a/src/rc-status.c b/src/rc-status.c index 5cde05ef..f75bfb83 100644 --- a/src/rc-status.c +++ b/src/rc-status.c @@ -55,6 +55,7 @@ static void print_service (char *service) } #include "_usage.h" +#define extraopts "[runlevel1] [runlevel2] ..." #define getoptstring "alsu" getoptstring_COMMON static const struct option longopts[] = { {"all", 0, NULL, 'a'}, |