Don't clutter the output with closed connection info unless threatened with -a. Notes: Wed Feb 3 15:27:45 EST 2010 geoff I don't think that we want to change the default usage of netstat at this late date. Reference: /n/sources/patch/sorry/netstat-open Date: Sun Nov 8 06:01:41 CET 2009 Signed-off-by: lyndon@orthanc.ca Reviewed-by: geoff --- /sys/src/cmd/netstat.c Sun Nov 8 05:59:47 2009 +++ /sys/src/cmd/netstat.c Sun Nov 8 05:59:45 2009 @@ -13,11 +13,11 @@ char *proto[20]; int nproto; int notrans; - +int showall; void usage(void) { - fprint(2, "usage: %s [-in] [-p proto] [network-dir]\n", argv0); + fprint(2, "usage: %s [-ain] [-p proto] [network-dir]\n", argv0); exits("usage"); } @@ -30,6 +30,9 @@ char buf[128]; ARGBEGIN{ + case 'a': + showall = 1; + break; case 'i': justinterfaces = 1; break; @@ -144,6 +147,9 @@ buf[n] = 0; close(fd); + if(!showall) + if(strncmp(buf, "Closed ", 7) == 0) + return; p = strchr(buf, ' '); if(p != 0) *p = 0; --- /sys/man/1/netstat Sun Nov 8 05:59:50 2009 +++ /sys/man/1/netstat Sun Nov 8 05:59:48 2009 @@ -4,7 +4,7 @@ .SH SYNOPSIS .B netstat [ -.B -in +.B -ain ] [ .B -p .I proto @@ -26,6 +26,9 @@ remote address. .PP The options are: +.TP +.B -a +Also print information about closed connections. .TP .B -i Instead of the usual listing, print one line per network interface.