Make it clear that -a flag and interface parameter are mutually exclusive

This commit is contained in:
Philippe Charnier 2003-08-16 22:23:16 +00:00
parent f29db4e7ef
commit b0fed5c6b6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=119003
2 changed files with 19 additions and 13 deletions

View File

@ -27,9 +27,13 @@
.Nd reverse ARP daemon .Nd reverse ARP daemon
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm .Nm
.Op Fl adfsv .Fl a
.Op Fl dfsv
.Op Fl t Ar directory .Op Fl t Ar directory
.Op Ar interface .Nm
.Op Fl dfsv
.Op Fl t Ar directory
.Ar interface
.Sh DESCRIPTION .Sh DESCRIPTION
The The
.Nm .Nm

View File

@ -32,8 +32,8 @@ __FBSDID("$FreeBSD$");
/* /*
* rarpd - Reverse ARP Daemon * rarpd - Reverse ARP Daemon
* *
* Usage: rarpd -a [ -dfsv ] [-t directory] [ hostname ] * Usage: rarpd -a [-dfsv] [-t directory] [hostname]
* rarpd [ -dfsv ] [-t directory] interface [ hostname ] * rarpd [-dfsv] [-t directory] interface [hostname]
* *
* 'hostname' is optional solely for backwards compatibility with Sun's rarpd. * 'hostname' is optional solely for backwards compatibility with Sun's rarpd.
* Currently, the argument is ignored. * Currently, the argument is ignored.
@ -145,7 +145,7 @@ main(int argc, char *argv[])
openlog(name, LOG_PID | LOG_CONS, LOG_DAEMON); openlog(name, LOG_PID | LOG_CONS, LOG_DAEMON);
opterr = 0; opterr = 0;
while ((op = getopt(argc, argv, "adfst:v")) != -1) { while ((op = getopt(argc, argv, "adfst:v")) != -1)
switch (op) { switch (op) {
case 'a': case 'a':
++aflag; ++aflag;
@ -175,16 +175,16 @@ main(int argc, char *argv[])
usage(); usage();
/* NOTREACHED */ /* NOTREACHED */
} }
} argc -= optind;
ifname = argv[optind++]; argv += optind;
hostname = ifname ? argv[optind] : NULL;
ifname = (aflag == 0) ? argv[0] : NULL;
hostname = ifname ? argv[1] : argv[0];
if ((aflag && ifname) || (!aflag && ifname == NULL)) if ((aflag && ifname) || (!aflag && ifname == NULL))
usage(); usage();
if (aflag) init(ifname);
init(NULL);
else
init(ifname);
if (!fflag) { if (!fflag) {
if (daemon(0,0)) { if (daemon(0,0)) {
@ -308,7 +308,9 @@ init(char *target)
static void static void
usage(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); exit(1);
} }