diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2015-10-23 08:21:28 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2015-10-23 08:21:28 +0000 |
commit | 7838f763673bd2ea7fc7ac3cbbccdb976f347ab7 (patch) | |
tree | a6ad13beeb7520a37cd947f2f3ad62ecc136205c /usr.sbin/iostat | |
parent | 634ca7597b517b98b230acfb9f3fc10098f5552a (diff) |
simplify argv back compat
Diffstat (limited to 'usr.sbin/iostat')
-rw-r--r-- | usr.sbin/iostat/iostat.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/usr.sbin/iostat/iostat.c b/usr.sbin/iostat/iostat.c index ced8091eef4..c85c6fc2cbb 100644 --- a/usr.sbin/iostat/iostat.c +++ b/usr.sbin/iostat/iostat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: iostat.c,v 1.38 2015/03/18 15:14:47 tedu Exp $ */ +/* $OpenBSD: iostat.c,v 1.39 2015/10/23 08:21:27 tedu Exp $ */ /* $NetBSD: iostat.c,v 1.10 1996/10/25 18:21:58 scottr Exp $ */ /* @@ -402,15 +402,12 @@ selectdrives(char *argv[]) * filled in and there are drives not taken care of, display the first * few that fit. * - * The backward compatibility #ifdefs permit the syntax: + * The backward compatibility syntax is: * iostat [ drives ] [ interval [ count ] ] */ -#define BACKWARD_COMPATIBILITY for (ndrives = 0; *argv; ++argv) { -#ifdef BACKWARD_COMPATIBILITY if (isdigit((unsigned char)**argv)) break; -#endif for (i = 0; i < dk_ndrive; i++) { if (strcmp(cur.dk_name[i], *argv)) continue; @@ -421,7 +418,6 @@ selectdrives(char *argv[]) if (i == dk_ndrive) errx(1, "invalid interval or drive name: %s", *argv); } -#ifdef BACKWARD_COMPATIBILITY if (*argv) { interval = strtonum(*argv, 1, INT_MAX, &errstr); if (errstr) @@ -430,9 +426,11 @@ selectdrives(char *argv[]) reps = strtonum(*argv, 1, INT_MAX, &errstr); if (errstr) errx(1, "repetition count is %s", errstr); + ++argv; } } -#endif + if (*argv) + errx(1, "too many arguments"); if (interval) { if (!reps) |