diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2000-09-24 22:12:26 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2000-09-24 22:12:26 +0000 |
commit | daa5b128d46cec446353f4c4762724f8c7c5f80e (patch) | |
tree | 0dde9c2a2c4b10f0a18dc4ae77f1092c57dd978d /usr.sbin | |
parent | 32fbb54d8d1b39395e0deef6c1023886b1566b4f (diff) |
Correctly ignore -n flag with -d when both options are separate (i.e.
arp -n -d, not arp -nd), millert@ ok
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/arp/arp.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.sbin/arp/arp.c b/usr.sbin/arp/arp.c index 7369e0de9c3..396c539e6b0 100644 --- a/usr.sbin/arp/arp.c +++ b/usr.sbin/arp/arp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: arp.c,v 1.14 1999/05/16 00:43:44 ho Exp $ */ +/* $OpenBSD: arp.c,v 1.15 2000/09/24 22:12:25 miod Exp $ */ /* $NetBSD: arp.c,v 1.12 1995/04/24 13:25:18 cgd Exp $ */ /* @@ -95,7 +95,7 @@ main(argc, argv) int argc; char **argv; { - int ch; + int ch, argstart; pid = getpid(); opterr = 0; @@ -103,6 +103,7 @@ main(argc, argv) if (ch == 'n') nflag = 1; + argstart = optind; optind = 1; optreset = 1; opterr = 1; @@ -112,9 +113,9 @@ main(argc, argv) dump(0); return (0); case 'd': - if (argc < 3 || argc > 4) + if (argc < (argstart + 1) || argc > (argstart +2)) usage(); - (void)delete(argv[2], argv[3]); + (void)delete(argv[argstart], argv[argstart + 1]); return (0); case 'n': break; |