Add extraopts to our usage

This commit is contained in:
Roy Marples 2007-09-21 11:52:37 +00:00
parent faa555efe2
commit e0d06f556e
4 changed files with 11 additions and 2 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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'},

View File

@ -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'},