diff options
author | mtaylor <mtaylor@FreeBSD.org> | 1999-08-30 20:49:31 +0000 |
---|---|---|
committer | mtaylor <mtaylor@FreeBSD.org> | 1999-08-30 20:49:31 +0000 |
commit | 0b81e841f1632c860d3c7627fa18872d7b0f6337 (patch) | |
tree | 5e30952051acdf0b1303a1bee52d2ccc7a6ab964 /usr.sbin/vnconfig/vnconfig.c | |
parent | f82f3c42eb7e6385b0100fd5fbf15da2ff2e0874 (diff) | |
download | FreeBSD-src-0b81e841f1632c860d3c7627fa18872d7b0f6337.zip FreeBSD-src-0b81e841f1632c860d3c7627fa18872d7b0f6337.tar.gz |
Make vnconfig's device argument not require a leading "/dev/", ala "ccdconfig".
Cleanup a few "-Wall -O" warnings.
Make "usage()" agree with man page.
Diffstat (limited to 'usr.sbin/vnconfig/vnconfig.c')
-rw-r--r-- | usr.sbin/vnconfig/vnconfig.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/usr.sbin/vnconfig/vnconfig.c b/usr.sbin/vnconfig/vnconfig.c index 04ace1e..ce1f7ea 100644 --- a/usr.sbin/vnconfig/vnconfig.c +++ b/usr.sbin/vnconfig/vnconfig.c @@ -46,6 +46,7 @@ static const char rcsid[] = "$FreeBSD$"; #endif /* not lint */ +#include <ctype.h> #include <err.h> #include <errno.h> #include <stdio.h> @@ -54,6 +55,7 @@ static const char rcsid[] = #include <unistd.h> #include <sys/param.h> #include <sys/ioctl.h> +#include <sys/linker.h> #include <sys/mount.h> #include <sys/module.h> #include <sys/stat.h> @@ -236,6 +238,14 @@ config(vnp) FILE *f; u_long l; + rv = 0; + + /* + * Prepend "/dev/" to the specified device name, if necessary. + * Operate on vnp->dev because it is used later. + */ + if (vnp->dev[0] != '/' && vnp->dev[0] != '.') + (void)asprintf(&vnp->dev, "/dev/%s", vnp->dev); dev = vnp->dev; file = vnp->file; flags = vnp->flags; @@ -318,7 +328,7 @@ config(vnp) if (rv) { warn("VNIO[GU]SET"); } else if (verbose) - printf("%s: flags now=%08x\n",dev,l); + printf("%s: flags now=%08lx\n",dev,l); } /* * Reset an option @@ -332,7 +342,7 @@ config(vnp) if (rv) { warn("VNIO[GU]CLEAR"); } else if (verbose) - printf("%s: flags now=%08x\n",dev,l); + printf("%s: flags now=%08lx\n",dev,l); } /* @@ -482,8 +492,10 @@ rawdevice(dev) static void usage() { - fprintf(stderr, -"usage: vnconfig [-acdefguv] [-s option] [-r option] [special-device file]\n"); + fprintf(stderr, "%s\n%s\n%s\n", + "usage: vnconfig [-cdeguv] [-s option] [-r option] [-S value] special_file", + " [regular_file] [feature]", + " vnconfig -a [-cdeguv] [-s option] [-r option] [-f config_file]"); exit(1); } |