From a0d68d0c626978a85c3e1e75153f39937b3a7c29 Mon Sep 17 00:00:00 2001 From: Alex Hornung Date: Wed, 5 Aug 2009 11:50:06 +0100 Subject: [PATCH] devfsctl - Add userfriendliness; correct #include Include path was incorrect and required manual mangling. Added some userfriendliness by printing a more or less useful usage message. --- usr.sbin/devfsctl/devfsctl.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/usr.sbin/devfsctl/devfsctl.c b/usr.sbin/devfsctl/devfsctl.c index 64c9f68969..56b1b3560b 100644 --- a/usr.sbin/devfsctl/devfsctl.c +++ b/usr.sbin/devfsctl/devfsctl.c @@ -41,8 +41,7 @@ #include #include #include -#define SPECNAMELEN 15 -#include +#include #include void dump_config(void); @@ -467,7 +466,22 @@ process_line(FILE* fd) void usage(void) { - printf("Usage: devfsctl [options] [command]\n"); + printf("Usage: devfsctl [options]\n"); + printf("Valid options and its arguments are:\n"); + printf(" -a\n\t\t Loads all read rules into the kernel and" + "applies them\n"); + printf(" -c\n\t\t Clears all rules stored in the kernel but" + "does not reset the nodes\n"); + printf(" -d\n\t\t Dumps the rules that have been loaded to the" + "screen to verify syntax\n"); + printf(" -f \n\t\t Specifies the configuration file" + "to be used\n"); + printf(" -m \n\t\t Specifies a mount point to which" + "the command will apply. By default it is *\n"); + printf(" -r\n\t\t Resets all devfs_nodes but does not clear" + "the rules stored\n"); + printf(" -v\n\t\t Enables verbose mode\n"); + exit(1); } @@ -477,11 +491,11 @@ int main(int argc, char *argv[]) struct devfs_rule *rule; int ch; size_t len; - char farg[1024], darg[1024], marg[1024]; + char farg[1024], marg[1024]; int fflag = 0, dflag = 0, mflag = 0; int aflag = 0, cflag = 0, rflag = 0; - while ((ch = getopt(argc, argv, "acdrvf:m:")) != -1) { + while ((ch = getopt(argc, argv, "acdf:hrvm:")) != -1) { switch (ch) { case 'v': verbose = 1; @@ -506,6 +520,7 @@ int main(int argc, char *argv[]) case 'd': dflag = 1; break; + case 'h': case '?': default: usage(); @@ -550,8 +565,9 @@ int main(int argc, char *argv[]) if (aflag) { jail = 0; +#if 0 read_config(farg); - +#endif rule_open(); len = strlen(marg); -- 2.11.4.GIT