From 9445c6500283cfee38b7b931707ed7e1c51fda98 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Tue, 24 Jun 2003 23:26:59 +0000 Subject: o don't need to include o include , not o mark usage() __dead o kill '?' in getopt switch o use __progname in usage() o ANSI function declarations Most from Andrey Matveev --- usr.sbin/vnconfig/vnconfig.c | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) (limited to 'usr.sbin/vnconfig/vnconfig.c') 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 #include #include -#include -#include #include #include #include +#include #include #include #include @@ -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); } -- cgit v1.2.3