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 | |
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')
-rw-r--r-- | usr.sbin/vnconfig/vnconfig.8 | 6 | ||||
-rw-r--r-- | usr.sbin/vnconfig/vnconfig.c | 20 |
2 files changed, 19 insertions, 7 deletions
diff --git a/usr.sbin/vnconfig/vnconfig.8 b/usr.sbin/vnconfig/vnconfig.8 index ea68e53..85ced18 100644 --- a/usr.sbin/vnconfig/vnconfig.8 +++ b/usr.sbin/vnconfig/vnconfig.8 @@ -185,18 +185,18 @@ option. .El .Sh EXAMPLES .Pp -.Dl vnconfig /dev/vn0c /tmp/diskimage +.Dl vnconfig vn0c /tmp/diskimage .Pp Configures the vnode disk .Pa vn0c . .Pp -.Dl vnconfig -e /dev/vn0c /var/swapfile swap +.Dl vnconfig -e vn0c /var/swapfile swap .Pp Configures .Pa vn0c and enables swapping on it. .Pp -.Dl vnconfig -d /dev/vn0c myfilesystem mount=/mnt +.Dl vnconfig -d vn0c myfilesystem mount=/mnt .Pp Unmounts (disables) .Pa vn0c . 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); } |