On Mon, Jun 19, 2017 at 12:15:49PM +0200, Klemens Nanni wrote:
> 'arp -[d]a' do not require hostname as told in the manual page.
>
> A single fprintf() is both shorter and cleaner.
>
this diff suggest that running arp without arguments should work, but it
does not.
there are a few approaches i guess. you could try and have SYNOPSIS show
every usage trickery, or assume the reader can work out that
this format of arp requires a hostname but, for example, the flag which
displays all current arp entries does not.
i prefer the latter (that is, how it is now). if i thought it was not
obvious how that worked, i'd say the fault lies in DESCRIPTION. but i
think it's clear here.
jmc
> Index: arp.8
> ===================================================================
> RCS file: /cvs/src/usr.sbin/arp/arp.8,v
> retrieving revision 1.39
> diff -u -p -r1.39 arp.8
> --- arp.8 5 Apr 2016 18:18:42 -0000 1.39
> +++ arp.8 19 Jun 2017 10:15:10 -0000
> @@ -40,7 +40,7 @@
> .Nm arp
> .Op Fl adn
> .Op Fl V Ar rdomain
> -.Ar hostname
> +.Op Ar hostname
> .Nm arp
> .Op Fl F
> .Op Fl f Ar file
> Index: arp.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/arp/arp.c,v
> retrieving revision 1.79
> diff -u -p -r1.79 arp.c
> --- arp.c 19 Apr 2017 05:36:12 -0000 1.79
> +++ arp.c 19 Jun 2017 10:15:10 -0000
> @@ -601,11 +601,10 @@ ether_str(struct sockaddr_dl *sdl)
> void
> usage(void)
> {
> - fprintf(stderr, "usage: arp [-adn] [-V rdomain] hostname\n");
> - fprintf(stderr, " arp [-F] [-f file] [-V rdomain] "
> - "-s hostname ether_addr\n"
> - " [temp | permanent] [pub]\n");
> - fprintf(stderr, " arp -W ether_addr [iface]\n");
> + fprintf(stderr, "usage: arp [-adn] [-V rdomain] [hostname]\n"
> + " arp [-F] [-f file] [-V rdomain] -s hostname ether_addr\n"
> + " [temp | permanent] [pub]\n"
> + " arp -W ether_addr [iface]\n");
> exit(1);
> }
>
>