On Sat, Jul 07, 2012 at 07:34:28AM -0300, Christiano F. Haesbaert wrote:
> How about this one ?
> It's your original idea, but I don't like that extra indentation level,
> we are already too deep.

Yes, less identation is always good!  The "multiple hosts" part
in the manpage could become one of the following, but it's clear
enough already.

"[...] and it can receive UDP datagrams from multiple hosts."
"[...] and it receives all UDP datagrams arriving at the port."

> 
> 
> Index: nc.1
> ===================================================================
> RCS file: /cvs/src/usr.bin/nc/nc.1,v
> retrieving revision 1.60
> diff -d -u -p -r1.60 nc.1
> --- nc.1      7 Feb 2012 12:11:43 -0000       1.60
> +++ nc.1      7 Jul 2012 10:30:10 -0000
> @@ -119,6 +119,10 @@ is completed.
>  It is an error to use this option without the
>  .Fl l
>  option.
> +When used together with the
> +.Fl u
> +option, the server socket is not connected and it receives UDP datagrams from
> +multiple hosts.
>  .It Fl l
>  Used to specify that
>  .Nm
> Index: netcat.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/nc/netcat.c,v
> retrieving revision 1.108
> diff -d -u -p -r1.108 netcat.c
> --- netcat.c  7 Jul 2012 09:36:30 -0000       1.108
> +++ netcat.c  7 Jul 2012 10:30:11 -0000
> @@ -345,11 +345,17 @@ main(int argc, char *argv[])
>                       if (s < 0)
>                               err(1, NULL);
>                       /*
> -                      * For UDP, we will use recvfrom() initially
> -                      * to wait for a caller, then use the regular
> -                      * functions to talk to the caller.
> +                      * For UDP and -k, don't connect the socket, let it
> +                      * receive datagrams from multiple socket pairs.
>                        */
> -                     if (uflag) {
> +                     if (uflag && kflag)
> +                             readwrite(s);
> +                     /*
> +                      * For UDP and not -k, we will use recvfrom() initially
> +                      * to wait for a caller, then use the regular functions
> +                      * to talk to the caller.
> +                      */
> +                     else if (uflag && !kflag) {
>                               int rv, plen;
>                               char buf[16384];
>                               struct sockaddr_storage z;

Reply via email to