diff options
author | Robert Nagy <robert@cvs.openbsd.org> | 2006-03-19 19:06:41 +0000 |
---|---|---|
committer | Robert Nagy <robert@cvs.openbsd.org> | 2006-03-19 19:06:41 +0000 |
commit | b5a07b3bf1af7fbd0cf9c0a9f644e9fc6dd07d84 (patch) | |
tree | f4cce175f129ca5e674cb93761104f3bee02edf7 /usr.bin/asa/asa.c | |
parent | 470a271fe2e6bcaaf4c1b3891534a2db09a4c37e (diff) |
use getopt(3)
from Jasper Lievisse Adriaanse <jasper@nedbsd.nl>; ok otto@
Diffstat (limited to 'usr.bin/asa/asa.c')
-rw-r--r-- | usr.bin/asa/asa.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/usr.bin/asa/asa.c b/usr.bin/asa/asa.c index 854ee908871..4901251bd34 100644 --- a/usr.bin/asa/asa.c +++ b/usr.bin/asa/asa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: asa.c,v 1.5 2003/06/25 21:08:59 deraadt Exp $ */ +/* $OpenBSD: asa.c,v 1.6 2006/03/19 19:06:40 robert Exp $ */ /* $NetBSD: asa.c,v 1.10 1995/04/21 03:01:41 cgd Exp $ */ /* @@ -32,22 +32,32 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: asa.c,v 1.5 2003/06/25 21:08:59 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: asa.c,v 1.6 2006/03/19 19:06:40 robert Exp $"; #endif #include <stdio.h> #include <stdlib.h> #include <err.h> +#include <unistd.h> static void asa(FILE *); +static void usage(void); int main(int argc, char *argv[]) { + int ch; FILE *fp; - /* skip progname */ - argv++; + while ((ch = getopt(argc, argv, "")) != -1) { + switch(ch) { + default: + usage(); + /* NOTREACHED */ + } + } + argc -= optind; + argv += optind; fp = stdin; do { @@ -115,3 +125,11 @@ asa(FILE *f) putchar ('\n'); } } + +static void +usage(void) +{ + extern char *__progname; + fprintf(stderr, "usage: %s [file ...]\n", __progname); + exit(1); +} |