Hi,

This is not a bug.

If you want to have a chance of getting your diff accepted, send it to
the proper list (tech@) and make sure your formatting conforms to
KNF, the diff isn't mangled by your mailer and the neccesary man page
pieces are included. 

        -Otto


On Thu, May 22, 2014 at 04:14:00PM +0800, Robert Young wrote:

> legends:
> -->
> -=>
> =->
> ==>
> <--
> <=-
> <-=
> <==
> 
> --- /usr/src/usr.bin/fstat/fstat.c Wed Oct 23 00:40:27 2013
> +++ /usr/src/usr.bin/fstat/fstat.c Thu May 22 15:59:22 2014
> @@ -616,6 +616,23 @@
>   }
>  }
> 
> +void print_connection_state(uint32_t s)
> +{char *o,p[]=" <==> ";
> + if(SS_CONNECTOUT&s)
> +  {o=p+1;
> +   o[0]=' ';
> +  }
> + else
> +  {o=p;
> +   o[4]=' ';
> +   o[5]=0;
> +  }
> + if(SS_CANTSENDMORE&s) p[2]='-';
> + if(SS_CANTRCVMORE&s) p[3]='-';
> + if(!(SS_ISCONNECTED&s)) p[2]=p[3]='-';
> + printf("%s",o);
> +}
> +
>  void
>  print_inet_details(struct kinfo_file *kf)
>  {
> @@ -629,10 +646,7 @@
>   printf(" %s:%d", laddr.s_addr == INADDR_ANY ? "*" :
>      inet_ntoa(laddr), ntohs(kf->inp_lport));
>   if (kf->inp_fport) {
> - if (kf->so_state & SS_CONNECTOUT)
> - printf(" --> ");
> - else
> - printf(" <-- ");
> + print_connection_state(kf->so_state);
>   printf("%s:%d",
>      faddr.s_addr == INADDR_ANY ? "*" :
>      inet_ntoa(faddr), ntohs(kf->inp_fport));
> @@ -669,10 +683,7 @@
>      IN6_IS_ADDR_UNSPECIFIED(&laddr6) ? "*" :
>      xaddrbuf, ntohs(kf->inp_lport));
>   if (kf->inp_fport) {
> - if (kf->so_state & SS_CONNECTOUT)
> - printf(" --> ");
> - else
> - printf(" <-- ");
> + print_connection_state(kf->so_state);
>   snprintf(xaddrbuf, sizeof(xaddrbuf), "[%s]",
>      inet6_addrstr(&faddr6));
>   printf("%s:%d",

Reply via email to