diff options
| author | 2015-10-23 08:21:27 +0000 | |
|---|---|---|
| committer | 2015-10-23 08:21:27 +0000 | |
| commit | 1986e87ff1719a9f16074fd1571a0054745a3e8e (patch) | |
| tree | 6c30506684d12220ed69c23a1ab00539870258e3 | |
| parent | further simplify argv (diff) | |
| download | wireguard-openbsd-1986e87ff1719a9f16074fd1571a0054745a3e8e.tar.xz wireguard-openbsd-1986e87ff1719a9f16074fd1571a0054745a3e8e.zip | |
simplify argv back compat
| -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) |
