summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2007-09-21 11:52:37 +0000
committerRoy Marples <roy@marples.name>2007-09-21 11:52:37 +0000
commite0d06f556ea52ee7e7d2044f116bd94187448577 (patch)
tree9c735041ff7c3204cbd95712ece6ee4dd7f859fc
parentfaa555efe24bd77f751c65c76596034ad7d2fe90 (diff)
downloadopenrc-e0d06f556ea52ee7e7d2044f116bd94187448577.tar.gz
openrc-e0d06f556ea52ee7e7d2044f116bd94187448577.tar.bz2
openrc-e0d06f556ea52ee7e7d2044f116bd94187448577.tar.xz
Add extraopts to our usage
-rw-r--r--src/_usage.c7
-rw-r--r--src/checkown.c4
-rw-r--r--src/mountinfo.c1
-rw-r--r--src/rc-status.c1
4 files changed, 11 insertions, 2 deletions
diff --git a/src/_usage.c b/src/_usage.c
index 54e30d9..28f9815 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 9402b8a..d9294da 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 6ed257a..c55a942 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 5cde05e..f75bfb8 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'},