summaryrefslogtreecommitdiff
path: root/usr.sbin/vnconfig
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2003-06-24 23:26:59 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2003-06-24 23:26:59 +0000
commit9445c6500283cfee38b7b931707ed7e1c51fda98 (patch)
tree70c46ff94ece2fdebba7d45eabf0ef52b38843de /usr.sbin/vnconfig
parent98d1771a47cd349b23aafa1c64a974473d68df38 (diff)
o don't need to include <sys/stat.h>
o include <fcntl.h>, not <sys/fcntl.h> o mark usage() __dead o kill '?' in getopt switch o use __progname in usage() o ANSI function declarations Most from Andrey Matveev
Diffstat (limited to 'usr.sbin/vnconfig')
-rw-r--r--usr.sbin/vnconfig/vnconfig.c29
1 files changed, 11 insertions, 18 deletions
diff --git a/usr.sbin/vnconfig/vnconfig.c b/usr.sbin/vnconfig/vnconfig.c
index 33a5815d212..2e1d8caf10a 100644
--- a/usr.sbin/vnconfig/vnconfig.c
+++ b/usr.sbin/vnconfig/vnconfig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vnconfig.c,v 1.11 2003/06/02 23:36:55 millert Exp $ */
+/* $OpenBSD: vnconfig.c,v 1.12 2003/06/24 23:26:58 millert Exp $ */
/*
* Copyright (c) 1993 University of Utah.
* Copyright (c) 1990, 1993
@@ -40,13 +40,12 @@
#include <sys/param.h>
#include <sys/ioctl.h>
#include <sys/mount.h>
-#include <sys/stat.h>
-#include <sys/fcntl.h>
#include <dev/vndioctl.h>
#include <err.h>
#include <errno.h>
+#include <fcntl.h>
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
@@ -59,13 +58,11 @@
int verbose = 0;
-void usage(void);
+__dead void usage(void);
int config(char *, char *, int, char *);
int
-main(argc, argv)
- int argc;
- char **argv;
+main(int argc, char **argv)
{
int ch, rv, action = VND_CONFIG;
char *key = NULL;
@@ -85,7 +82,6 @@ main(argc, argv)
key = getpass("Encryption key: ");
break;
default:
- case '?':
usage();
/* NOTREACHED */
}
@@ -103,11 +99,7 @@ main(argc, argv)
}
int
-config(dev, file, action, key)
- char *dev;
- char *file;
- int action;
- char *key;
+config(char *dev, char *file, int action, char *key)
{
struct vnd_ioctl vndio;
FILE *f;
@@ -156,12 +148,13 @@ config(dev, file, action, key)
return (rv < 0);
}
-void
-usage()
+__dead void
+usage(void)
{
+ extern char *__progname;
- (void)fprintf(stderr, "%s%s",
- "usage: vnconfig [-c] [-vk] rawdev regular-file\n",
- " vnconfig -u [-v] rawdev\n");
+ (void)fprintf(stderr,
+ "usage: %s [-c] [-vk] rawdev regular-file\n"
+ " %s -u [-v] rawdev\n", __progname, __progname);
exit(1);
}