diff options
author | charnier <charnier@FreeBSD.org> | 2003-08-16 22:23:16 +0000 |
---|---|---|
committer | charnier <charnier@FreeBSD.org> | 2003-08-16 22:23:16 +0000 |
commit | 88ab3bade32deddff57c38395d6ae58f9eee2760 (patch) | |
tree | 8b40ea6dc768fbf781e92aa9da218eeeb9b619a4 /usr.sbin | |
parent | 531d1f33340632ea6624163435196b94ddcd70bd (diff) | |
download | FreeBSD-src-88ab3bade32deddff57c38395d6ae58f9eee2760.zip FreeBSD-src-88ab3bade32deddff57c38395d6ae58f9eee2760.tar.gz |
Make it clear that -a flag and interface parameter are mutually exclusive
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/rarpd/rarpd.8 | 8 | ||||
-rw-r--r-- | usr.sbin/rarpd/rarpd.c | 24 |
2 files changed, 19 insertions, 13 deletions
diff --git a/usr.sbin/rarpd/rarpd.8 b/usr.sbin/rarpd/rarpd.8 index cbc61e0..88c1eeb 100644 --- a/usr.sbin/rarpd/rarpd.8 +++ b/usr.sbin/rarpd/rarpd.8 @@ -27,9 +27,13 @@ .Nd reverse ARP daemon .Sh SYNOPSIS .Nm -.Op Fl adfsv +.Fl a +.Op Fl dfsv +.Op Fl t Ar directory +.Nm +.Op Fl dfsv .Op Fl t Ar directory -.Op Ar interface +.Ar interface .Sh DESCRIPTION The .Nm diff --git a/usr.sbin/rarpd/rarpd.c b/usr.sbin/rarpd/rarpd.c index 9b6d6f3..1de2282 100644 --- a/usr.sbin/rarpd/rarpd.c +++ b/usr.sbin/rarpd/rarpd.c @@ -32,8 +32,8 @@ __FBSDID("$FreeBSD$"); /* * rarpd - Reverse ARP Daemon * - * Usage: rarpd -a [ -dfsv ] [-t directory] [ hostname ] - * rarpd [ -dfsv ] [-t directory] interface [ hostname ] + * Usage: rarpd -a [-dfsv] [-t directory] [hostname] + * rarpd [-dfsv] [-t directory] interface [hostname] * * 'hostname' is optional solely for backwards compatibility with Sun's rarpd. * Currently, the argument is ignored. @@ -145,7 +145,7 @@ main(int argc, char *argv[]) openlog(name, LOG_PID | LOG_CONS, LOG_DAEMON); opterr = 0; - while ((op = getopt(argc, argv, "adfst:v")) != -1) { + while ((op = getopt(argc, argv, "adfst:v")) != -1) switch (op) { case 'a': ++aflag; @@ -175,16 +175,16 @@ main(int argc, char *argv[]) usage(); /* NOTREACHED */ } - } - ifname = argv[optind++]; - hostname = ifname ? argv[optind] : NULL; + argc -= optind; + argv += optind; + + ifname = (aflag == 0) ? argv[0] : NULL; + hostname = ifname ? argv[1] : argv[0]; + if ((aflag && ifname) || (!aflag && ifname == NULL)) usage(); - if (aflag) - init(NULL); - else - init(ifname); + init(ifname); if (!fflag) { if (daemon(0,0)) { @@ -308,7 +308,9 @@ init(char *target) static void usage(void) { - (void)fprintf(stderr, "usage: rarpd [-adfsv] [-t directory] [interface]\n"); + (void)fprintf(stderr, "%s\n%s\n", + "usage: rarpd -a [-dfsv] [-t directory]", + " rarpd [-dfsv] [-t directory] interface"); exit(1); } |