summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1995-08-03 03:56:48 +0000
committerjkh <jkh@FreeBSD.org>1995-08-03 03:56:48 +0000
commit166b402330a4d001fb35d483cbcde348ce62ec1b (patch)
treefa8bdd35b87f1a79c7f1f39de1f3e7917d874cea
parent8c29b4e98967f765b33a534435f1dcbf25bddd75 (diff)
downloadFreeBSD-src-166b402330a4d001fb35d483cbcde348ce62ec1b.zip
FreeBSD-src-166b402330a4d001fb35d483cbcde348ce62ec1b.tar.gz
Make arp command actually behave as documented with the addition of a -f
flag. The getopt handling in here is actually pretty bogus (not Phil's fault - it's original sin) but the general approach is working so I'm not going to break it. Some small tweaks of my own to add error checking to what was originally submitted. Strange how nobody noticed that the flag was documented but completely missing from the code before! [jkh]. Submitted by: Phil Taylor <phil@zipmail.co.uk>
-rw-r--r--usr.sbin/arp/arp.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.sbin/arp/arp.c b/usr.sbin/arp/arp.c
index 44703ea..1eb718a 100644
--- a/usr.sbin/arp/arp.c
+++ b/usr.sbin/arp/arp.c
@@ -83,7 +83,7 @@ main(argc, argv)
int ch;
pid = getpid();
- while ((ch = getopt(argc, argv, "ands")) != EOF)
+ while ((ch = getopt(argc, argv, "andfs")) != EOF)
switch((char)ch) {
case 'a':
dump(0);
@@ -100,6 +100,11 @@ main(argc, argv)
if (argc < 4 || argc > 7)
usage();
exit(set(argc-2, &argv[2]) ? 1 : 0);
+ case 'f' :
+ if (argc != 3)
+ usage();
+ file(argv[2]);
+ exit(0);
case '?':
default:
usage();
OpenPOWER on IntegriCloud