diff options
author | keerthi <none@none> | 2007-12-21 12:39:32 -0800 |
---|---|---|
committer | keerthi <none@none> | 2007-12-21 12:39:32 -0800 |
commit | ba753d4a1cf19adb873981f5e1dbc4daa05f91ab (patch) | |
tree | 3712e1b5284b9ad89c4f33ccbf29111cc8f43a16 | |
parent | 7449d41fd6d3a8dedceb5bdd8fd63ac8fd0258ea (diff) | |
download | illumos-joyent-ba753d4a1cf19adb873981f5e1dbc4daa05f91ab.tar.gz |
6236983 netstat -iv adds many blank (null) lines to output
-rw-r--r-- | usr/src/cmd/cmd-inet/usr.bin/netstat/netstat.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/usr/src/cmd/cmd-inet/usr.bin/netstat/netstat.c b/usr/src/cmd/cmd-inet/usr.bin/netstat/netstat.c index 1a1de3a33d..1a964f0ce2 100644 --- a/usr/src/cmd/cmd-inet/usr.bin/netstat/netstat.c +++ b/usr/src/cmd/cmd-inet/usr.bin/netstat/netstat.c @@ -2578,6 +2578,7 @@ if_report(mib_item_t *item, char *matchname, int jtemp = 0; uint32_t ifindex_v4 = 0; uint32_t ifindex_v6 = 0; + boolean_t first_header = B_TRUE; /* 'for' loop 1: */ for (; item; item = item->next_item) { @@ -2652,6 +2653,9 @@ if_report(mib_item_t *item, char *matchname, kstat_named_value(ksp, "collisions"); if (first) { + if (!first_header) + (void) putchar('\n'); + first_header = B_FALSE; (void) printf( "%-5.5s %-5.5s%-13.13s " "%-14.14s %-6.6s %-5.5s " @@ -2661,7 +2665,8 @@ if_report(mib_item_t *item, char *matchname, "Address", "Ipkts", "Ierrs", "Opkts", "Oerrs", "Collis", "Queue"); - first = B_FALSE; + + first = B_FALSE; } if_report_ip4(ap, ifname, logintname, &stat, B_TRUE); @@ -2671,8 +2676,6 @@ if_report(mib_item_t *item, char *matchname, logintname, &stat, B_FALSE); } } /* 'for' loop 2a ends */ - if (!first) - (void) putchar('\n'); } else if (!alreadydone) { char ifname[LIFNAMSIZ + 1]; char buf[LIFNAMSIZ + 1]; @@ -2944,6 +2947,9 @@ if_report(mib_item_t *item, char *matchname, kstat_named_value(ksp, "collisions"); if (first) { + if (!first_header) + (void) putchar('\n'); + first_header = B_FALSE; (void) printf( "%-5.5s %-5.5s%" "-27.27s %-27.27s " @@ -2965,8 +2971,6 @@ if_report(mib_item_t *item, char *matchname, logintname, &stat, B_FALSE); } } /* 'for' loop 2d ends */ - if (!first) - (void) putchar('\n'); } else if (!alreadydone) { char ifname[LIFNAMSIZ + 1]; char buf[IFNAMSIZ + 1]; @@ -3180,10 +3184,10 @@ if_report(mib_item_t *item, char *matchname, break; } } - if (Iflag_only == 0) - (void) putchar('\n'); (void) fflush(stdout); } /* 'for' loop 1 ends */ + if ((Iflag_only == 0) && (!once_only)) + (void) putchar('\n'); reentry = B_TRUE; } |