-# $Id: Makefile,v 1.1.1.1 1995/10/18 08:48:31 deraadt Exp $
+# $Id: Makefile,v 1.2 1996/12/21 05:07:41 deraadt Exp $
-PROG= vnconfig
-MAN= vnconfig.8
+PROG= vnconfig
+MAN= vnconfig.8
+DPADD= ${LIBUTIL}
+LDADD= -lutil
.include <bsd.prog.mk>
#include <sys/ioctl.h>
#include <sys/mount.h>
#include <sys/stat.h>
+#include <sys/fcntl.h>
#include <dev/vndioctl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <util.h>
#define VND_CONFIG 1
#define VND_UNCONFIG 2
int verbose = 0;
-char *rawdevice __P((char *));
void usage __P((void));
main(argc, argv)
char *rdev;
int rv;
- rdev = rawdevice(dev);
+ if (opendev(dev, O_RDWR, OPENDEV_PART, &rdev) < 0)
+ err(4, "%s", rdev);
f = fopen(rdev, "rw");
if (f == NULL) {
warn(rdev);
return (rv < 0);
}
-char *
-rawdevice(dev)
- char *dev;
-{
- register char *rawbuf, *dp, *ep;
- struct stat sb;
- int len;
-
- len = strlen(dev);
- rawbuf = malloc(len + 2);
- strcpy(rawbuf, dev);
- if (stat(rawbuf, &sb) != 0 || !S_ISCHR(sb.st_mode)) {
- dp = rindex(rawbuf, '/');
- if (dp) {
- for (ep = &rawbuf[len]; ep > dp; --ep)
- *(ep+1) = *ep;
- *++ep = 'r';
- }
- }
- return (rawbuf);
-}
-
void
usage()
{