Subject: bin/6927: netstat -s -s incomplete
To: None <gnats-bugs@gnats.netbsd.org>
From: None <bgrayson@ece.utexas.edu>
List: netbsd-bugs
Date: 02/02/1999 00:07:50
>Number:         6927
>Category:       bin
>Synopsis:       netstat -s -s incomplete
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Feb  1 22:20:01 1999
>Last-Modified:
>Originator:     Brian Grayson
>Organization:
	Parallel and Distributed Systems
	Electrical and Computer Engineering
	The University of Texas at Austin
>Release:        Jan 31, 1999
>Environment:

>Description:
	The man page states that if two -s options are given,
	all zero-valued fields are not printed.  However, this
	isn't always followed.
>How-To-Repeat:
>Fix:
	I fixed a whole bunch of the printouts in iso.c.  There
	are still some headers that probably ought to not be
	printed, but I have no knowledge of ISO networking stuff,
	so I don't want to remove too much from the output.
--- iso.c.dist	Mon Feb  1 22:45:11 1999
+++ iso.c	Tue Feb  2 00:04:32 1999
@@ -129,20 +129,20 @@
 	if (off == 0 ||
 	    kread(off, (char *)&esis_stat, sizeof (struct esis_stat)))
 		return;
+#define ps(f,m) if (esis_stat.f || sflag <= 1 ) \
+	  printf(m, esis_stat.f, plural(esis_stat.f))
+#define p2(f1,f2,m) if (esis_stat.f1 || esis_stat.f2 || sflag <= 1 ) \
+	printf(m, esis_stat.f1, esis_stat.f2)
+
 	printf("%s:\n", name);
-	printf("\t%d esh sent, %d esh received\n", esis_stat.es_eshsent,
-		esis_stat.es_eshrcvd);
-	printf("\t%d ish sent, %d ish received\n", esis_stat.es_ishsent,
-		esis_stat.es_ishrcvd);
-	printf("\t%d rd sent, %d rd received\n", esis_stat.es_rdsent,
-		esis_stat.es_rdrcvd);
-	printf("\t%d pdus not sent due to insufficient memory\n",
-		esis_stat.es_nomem);
-	printf("\t%d pdus received with bad checksum\n", esis_stat.es_badcsum);
-	printf("\t%d pdus received with bad version number\n",
-		esis_stat.es_badvers);
-	printf("\t%d pdus received with bad type field\n", esis_stat.es_badtype);
-	printf("\t%d short pdus received\n", esis_stat.es_toosmall);
+	p2(es_eshsent, es_eshrcvd, "\t%d esh sent, %d esh received\n");
+	p2(es_ishsent, es_ishrcvd, "\t%d ish sent, %d ish received\n");
+	p2(es_rdsent, es_rdrcvd, "\t%d rd sent, %d rd received\n");
+	ps(es_nomem, "\t%d pdu%s not sent due to insufficient memory\n");
+	ps(es_badcsum, "\t%d pdu%s received with bad checksum\n");
+	ps(es_badvers, "\t%d pdu%s received with bad version number\n");
+	ps(es_badtype, "\t%d pdu%s received with bad type field\n");
+	ps(es_toosmall, "\t%d short pdu%s received\n");
 }
 
 /*
@@ -159,26 +159,28 @@
 	    kread(off, (char *)&clnp_stat, sizeof (clnp_stat)))
 		return;
 
-	printf("%s:\n\t%d total packets sent\n", name, clnp_stat.cns_sent);
-	printf("\t%d total fragments sent\n", clnp_stat.cns_fragments);
-	printf("\t%d total packets received\n", clnp_stat.cns_total);
-	printf("\t%d with fixed part of header too small\n",
-		clnp_stat.cns_toosmall);
-	printf("\t%d with header length not reasonable\n", clnp_stat.cns_badhlen);
-	printf("\t%d incorrect checksum%s\n",
-		clnp_stat.cns_badcsum, plural(clnp_stat.cns_badcsum));
-	printf("\t%d with unreasonable address lengths\n", clnp_stat.cns_badaddr);
-	printf("\t%d with forgotten segmentation information\n",
-		clnp_stat.cns_noseg);
-	printf("\t%d with an incorrect protocol identifier\n", clnp_stat.cns_noproto);
-	printf("\t%d with an incorrect version\n", clnp_stat.cns_badvers);
-	printf("\t%d dropped because the ttl has expired\n",
-		clnp_stat.cns_ttlexpired);
-	printf("\t%d clnp cache misses\n", clnp_stat.cns_cachemiss);
-	printf("\t%d clnp congestion experience bits set\n",
-		clnp_stat.cns_congest_set);
-	printf("\t%d clnp congestion experience bits received\n",
-		clnp_stat.cns_congest_rcvd);
+#define clnp_p(f,m) if (clnp_stat.f || sflag <= 1 ) \
+    printf(m, clnp_stat.f)
+#define	clnp_ps(f, m) if (clnp_stat.f || sflag <= 1) \
+    printf(m, clnp_stat.f, plural(clnp_stat.f))
+#define	clnp_pes(f, m) if (clnp_stat.f || sflag <= 1) \
+    printf(m, clnp_stat.f, (clnp_stat.f == 1) ? "" : "es")
+
+	printf("%s:\n", name);
+	clnp_ps(cns_sent, "\t%d total packet%s sent\n");
+	clnp_ps(cns_fragments, "\t%d total fragment%s sent\n");
+	clnp_ps(cns_total, "\t%d total packet%s received\n");
+	clnp_p(cns_toosmall, "\t%d with fixed part of header too small\n");
+	clnp_p(cns_badhlen, "\t%d with header length not reasonable\n");
+	clnp_ps(cns_badcsum, "\t%d incorrect checksum%s\n");
+	clnp_p(cns_badaddr, "\t%d with unreasonable address lengths\n");
+	clnp_p(cns_noseg, "\t%d with forgotten segmentation information\n");
+	clnp_p(cns_noproto, "\t%d with an incorrect protocol identifier\n");
+	clnp_p(cns_badvers, "\t%d with an incorrect version\n");
+	clnp_p(cns_ttlexpired, "\t%d dropped because the ttl has expired\n");
+	clnp_pes(cns_cachemiss, "\t%d clnp cache miss%s\n");
+	clnp_ps(cns_congest_set, "\t%d clnp congestion experience bit%s set\n");
+	clnp_ps(cns_congest_rcvd, "\t%d clnp congestion experience bit%s received\n");
 }
 /*
  * Dump CLTP statistics structure.
@@ -193,12 +195,12 @@
 	if (off == 0 ||
 	    kread(off, (char *)&cltpstat, sizeof (cltpstat)))
 		return;
-	printf("%s:\n\t%u incomplete header%s\n", name,
-		cltpstat.cltps_hdrops, plural(cltpstat.cltps_hdrops));
-	printf("\t%u bad data length field%s\n",
-		cltpstat.cltps_badlen, plural(cltpstat.cltps_badlen));
-	printf("\t%u bad checksum%s\n",
-		cltpstat.cltps_badsum, plural(cltpstat.cltps_badsum));
+#define cltp_ps(f,m) if (cltpstat.f || sflag <= 1 ) \
+    printf(m, cltpstat.f, plural(cltpstat.f))
+	printf("%s:\n", name);
+	cltp_ps(cltps_hdrops, "\t%u incomplete header%s\n");
+	cltp_ps(cltps_badlen, "\t%u bad data length field%s\n");
+	cltp_ps(cltps_badsum, "\t%u bad checksum%s\n");
 }
 
 struct	tp_pcb tpcb;
@@ -561,121 +563,71 @@
 	struct tp_stat *s;
 	int indent;
 {
-	fprintf(stdout,
-		"%*sReceiving:\n",indent," ");
-	fprintf(stdout,
-		"\t%*s%ld variable parameter%s ignored\n", indent," ",
-		s->ts_param_ignored, plural(s->ts_param_ignored));
-	fprintf(stdout,
-		"\t%*s%ld invalid parameter code%s\n", indent, " ",
-		s->ts_inv_pcode, plural(s->ts_inv_pcode));
-	fprintf(stdout,
-		"\t%*s%ld invalid parameter value%s\n", indent, " ",
-		s->ts_inv_pval, plural(s->ts_inv_pval));
-	fprintf(stdout,
-		"\t%*s%ld invalid dutype%s\n", indent, " ",
-		s->ts_inv_dutype, plural(s->ts_inv_dutype));
-	fprintf(stdout,
-		"\t%*s%ld negotiation failure%s\n", indent, " ",
-		s->ts_negotfailed, plural(s->ts_negotfailed));
-	fprintf(stdout,
-		"\t%*s%ld invalid destination reference%s\n", indent, " ",
-		s->ts_inv_dref, plural(s->ts_inv_dref));
-	fprintf(stdout,
-		"\t%*s%ld invalid suffix parameter%s\n", indent, " ",
-		s->ts_inv_sufx, plural(s->ts_inv_sufx));
-	fprintf(stdout,
-		"\t%*s%ld invalid length\n",indent, " ", s->ts_inv_length);
-	fprintf(stdout,
-		"\t%*s%ld invalid checksum%s\n", indent, " ",
-		s->ts_bad_csum, plural(s->ts_bad_csum));
-	fprintf(stdout,
-		"\t%*s%ld DT%s out of order\n", indent, " ",
-		s->ts_dt_ooo, plural(s->ts_dt_ooo));
-	fprintf(stdout,
-		"\t%*s%ld DT%s not in window\n", indent, " ",
-		s->ts_dt_niw, plural(s->ts_dt_niw));
-	fprintf(stdout,
-		"\t%*s%ld duplicate DT%s\n", indent, " ",
-		s->ts_dt_dup, plural(s->ts_dt_dup));
-	fprintf(stdout, "\t%*s%ld XPD%s not in window\n", indent, " ",
-		s->ts_xpd_niw, plural(s->ts_xpd_niw));
-	fprintf(stdout, "\t%*s%ld XPD%s w/o credit to stash\n", indent, " ",
-		s->ts_xpd_dup, plural(s->ts_xpd_dup));
-	fprintf(stdout,
-		"\t%*s%ld time%s local credit reneged\n", indent, " ",
-		s->ts_lcdt_reduced, plural(s->ts_lcdt_reduced));
-	fprintf(stdout,
-		"\t%*s%ld concatenated TPDU%s\n", indent, " ",
-		s->ts_concat_rcvd, plural(s->ts_concat_rcvd));
-	fprintf(stdout,
-		"%*sSending:\n", indent, " ");
-	fprintf(stdout,
-		"\t%*s%ld XPD mark%s discarded\n", indent, " ",
-		s->ts_xpdmark_del, plural(s->ts_xpdmark_del));
-	fprintf(stdout,
-		"\t%*sXPD stopped data flow %ld time%s\n", indent, " ",
-		s->ts_xpd_intheway, plural(s->ts_xpd_intheway));
-	fprintf(stdout,
-		"\t%*s%ld time%s foreign window closed\n", indent, " ",
-		s->ts_zfcdt, plural(s->ts_zfcdt));
-	fprintf(stdout,
-		"%*sMiscellaneous:\n", indent, " ");
-	fprintf(stdout,
-		"\t%*s%ld small mbuf%s\n", indent, " ",
-		s->ts_mb_small, plural(s->ts_mb_small));
-	fprintf(stdout,
-		"\t%*s%ld cluster%s\n", indent, " ",
-		s->ts_mb_cluster, plural(s->ts_mb_cluster));
-	fprintf(stdout,
-		"\t%*s%ld source quench \n",indent, " ",
-		s->ts_quench);
-	fprintf(stdout,
-		"\t%*s%ld dec bit%s\n", indent, " ",
-		s->ts_rcvdecbit, plural(s->ts_rcvdecbit));
-	fprintf(stdout,
-		"\t%*sM:L ( M mbuf chains of length L)\n", indent, " ");
-	{
-		int j;
+  	int mbufprintme = 0, k;
 
-		fprintf(stdout, "\t%*s%ld: over 16\n", indent, " ",
-		s->ts_mb_len_distr[0]);
-		for( j=1; j<=8; j++) {
-			fprintf(stdout,
-				"\t%*s%ld: %d\t\t%ld: %d\n", indent, " ",
-				s->ts_mb_len_distr[j],j,
-				s->ts_mb_len_distr[j<<1],j<<1
-				);
-		}
-	}
-	fprintf(stdout,
-		"\t%*s%ld EOT rcvd\n",  indent, " ", s->ts_eot_input);
-	fprintf(stdout,
-		"\t%*s%ld EOT sent\n",  indent, " ", s->ts_EOT_sent);
-	fprintf(stdout,
-		"\t%*s%ld EOT indication%s\n",  indent, " ",
-		s->ts_eot_user, plural(s->ts_eot_user));
-
-	fprintf(stdout,
-		"%*sConnections:\n", indent, " ");
-	fprintf(stdout,
-		"\t%*s%ld connection%s used extended format\n",  indent, " ",
-		s->ts_xtd_fmt, plural(s->ts_xtd_fmt));
-	fprintf(stdout,
-		"\t%*s%ld connection%s allowed transport expedited data\n",  indent, " ",
-		s->ts_use_txpd, plural(s->ts_use_txpd));
-	fprintf(stdout,
-		"\t%*s%ld connection%s turned off checksumming\n",  indent, " ",
-		s->ts_csum_off, plural(s->ts_csum_off));
-	fprintf(stdout,
-		"\t%*s%ld connection%s dropped due to retrans limit\n",  indent, " ",
-		s->ts_conn_gaveup, plural(s->ts_conn_gaveup));
-	fprintf(stdout,
-		"\t%*s%ld tp 4 connection%s\n",  indent, " ",
-		s->ts_tp4_conn, plural(s->ts_tp4_conn));
-	fprintf(stdout,
-		"\t%*s%ld tp 0 connection%s\n",  indent, " ",
-		s->ts_tp0_conn, plural(s->ts_tp0_conn));
+	printf("%*sReceiving:\n",indent," ");
+#define tp(f,m) if (s->f || sflag <= 1 ) \
+    printf(m, indent, " ", s->f)
+#define tps(f,m) if (s->f || sflag <= 1 ) \
+    printf(m, indent, " ", s->f, plural(s->f))
+	tps(ts_param_ignored, "\t%*s%ld variable parameter%s ignored\n");
+	tps(ts_inv_pcode, "\t%*s%ld invalid parameter code%s\n");
+	tps(ts_inv_pval, "\t%*s%ld invalid parameter value%s\n");
+	tps(ts_inv_dutype, "\t%*s%ld invalid dutype%s\n");
+	tps(ts_negotfailed, "\t%*s%ld negotiation failure%s\n");
+	tps(ts_inv_dref, "\t%*s%ld invalid destination reference%s\n");
+	tps(ts_inv_sufx, "\t%*s%ld invalid suffix parameter%s\n");
+	tp(ts_inv_length, "\t%*s%ld invalid length\n");
+	tps(ts_bad_csum, "\t%*s%ld invalid checksum%s\n");
+	tps(ts_dt_ooo, "\t%*s%ld DT%s out of order\n");
+	tps(ts_dt_niw, "\t%*s%ld DT%s not in window\n");
+	tps(ts_dt_dup, "\t%*s%ld duplicate DT%s\n");
+	tps(ts_xpd_niw, "\t%*s%ld XPD%s not in window\n");
+	tps(ts_xpd_dup, "\t%*s%ld XPD%s w/o credit to stash\n");
+	tps(ts_lcdt_reduced, "\t%*s%ld time%s local credit reneged\n");
+	tps(ts_concat_rcvd, "\t%*s%ld concatenated TPDU%s\n");
+	if (s->ts_xpdmark_del || s->ts_xpd_intheway
+	    || s->ts_zfcdt || sflag <= 1) {
+		printf("%*sSending:\n", indent, " ");
+		tps(ts_xpdmark_del, "\t%*s%ld XPD mark%s discarded\n");
+		tps(ts_xpd_intheway, "\t%*sXPD stopped data flow %ld time%s\n");
+		tps(ts_zfcdt, "\t%*s%ld time%s foreign window closed\n");
+	}
+	if (s->ts_mb_small || s->ts_mb_cluster || s->ts_quench
+	    || s->ts_rcvdecbit || sflag <= 1) {
+		printf("%*sMiscellaneous:\n", indent, " ");
+		tps(ts_mb_small, "\t%*s%ld small mbuf%s\n");
+		tps(ts_mb_cluster, "\t%*s%ld cluster%s\n");
+		tp(ts_quench, "\t%*s%ld source quench \n");
+		tps(ts_rcvdecbit, "\t%*s%ld dec bit%s\n");
+	}
+	for (k=0; k<=8; k++)
+		mbufprintme = mbufprintme || s->ts_mb_len_distr[k];
+	if (mbufprintme || sflag <= 1){
+		printf("\t%*sM:L ( M mbuf chains of length L)\n", indent, " ");
+		{
+			int j;
+			printf("\t%*s%ld: over 16\n", indent, " ",
+			s->ts_mb_len_distr[0]);
+			for( j=1; j<=8; j++) {
+				printf("\t%*s%ld: %d\t\t%ld: %d\n", indent, " ",
+					s->ts_mb_len_distr[j],j,
+					s->ts_mb_len_distr[j<<1],j<<1
+					);
+			}
+		}
+	}
+	tp(ts_eot_input, "\t%*s%ld EOT rcvd\n");
+	tp(ts_EOT_sent, "\t%*s%ld EOT sent\n");
+	tps(ts_eot_user, "\t%*s%ld EOT indication%s\n");
+
+	printf("%*sConnections:\n", indent, " ");
+	tps(ts_xtd_fmt, "\t%*s%ld connection%s used extended format\n");
+	tps(ts_use_txpd, "\t%*s%ld connection%s allowed transport expedited data\n");
+	tps(ts_csum_off, "\t%*s%ld connection%s turned off checksumming\n");
+	tps(ts_conn_gaveup, "\t%*s%ld connection%s dropped due to retrans limit\n");
+	tps(ts_tp4_conn, "\t%*s%ld tp 4 connection%s\n");
+	tps(ts_tp0_conn, "\t%*s%ld tp 0 connection%s\n");
     {
 		int j;
 		static char *name[]= {
@@ -684,122 +636,126 @@
 			" LOCAL,~PDN",
 			" LOCAL, PDN"
 		};
+		int something_to_print = 0;
 
-		fprintf(stdout,
-			"\n%*sRound trip times, listed in ticks:\n", indent, " ");
-		fprintf(stdout,
-			"\t%*s%11.11s  %12.12s | %12.12s | %s\n", indent, " ",
+		for (j = 0; j <= 3; j++) {
+		  something_to_print = something_to_print
+		    || s->ts_rtt[j] || s->ts_rtv[j];
+		}
+		if (something_to_print || sflag <= 1) {
+			printf("\n%*sRound trip times, listed in ticks:\n",
+				indent, " ");
+			printf("\t%*s%11.11s  %12.12s | %12.12s | %s\n",
+				indent, " ",
 				"Category",
 				"Smoothed avg", "Deviation", "Deviation/Avg");
-		for (j = 0; j <= 3; j++) {
-			fprintf(stdout,
-				"\t%*s%11.11s: %-11d | %-11d | %-11d | %-11d\n", indent, " ",
-				name[j],
-				s->ts_rtt[j],
-				s->ts_rtt[j],
-				s->ts_rtv[j],
-				s->ts_rtv[j]);
-		}
-	}
-	fprintf(stdout,
-"\n%*sTpdus RECVD [%ld valid, %3.6f %% of total (%ld); %ld dropped]\n",indent," ",
-		s->ts_tpdu_rcvd, 
-		((s->ts_pkt_rcvd > 0) ?
-			((100 * (float)s->ts_tpdu_rcvd)/(float)s->ts_pkt_rcvd)
-			: 0),
-		s->ts_pkt_rcvd,
-		s->ts_recv_drop );
-
-	fprintf(stdout,
-		"\t%*sDT  %6ld   AK  %6ld   DR  %4ld   CR  %4ld \n", indent, " ",
-		s->ts_DT_rcvd, s->ts_AK_rcvd, s->ts_DR_rcvd, s->ts_CR_rcvd);
-	fprintf(stdout,
-		"\t%*sXPD %6ld   XAK %6ld   DC  %4ld   CC  %4ld   ER  %4ld\n",  indent, " ",
-		s->ts_XPD_rcvd, s->ts_XAK_rcvd, s->ts_DC_rcvd, s->ts_CC_rcvd,
-		s->ts_ER_rcvd);
-	fprintf(stdout,
-		"\n%*sTpdus SENT [%ld total, %ld dropped]\n",  indent, " ",
-		s->ts_tpdu_sent, s->ts_send_drop);
-
-	fprintf(stdout,
-		"\t%*sDT  %6ld   AK  %6ld   DR  %4ld   CR  %4ld \n", indent, " ",
-		s->ts_DT_sent, s->ts_AK_sent, s->ts_DR_sent, s->ts_CR_sent);
-	fprintf(stdout,
-		"\t%*sXPD %6ld   XAK %6ld   DC  %4ld   CC  %4ld   ER  %4ld\n",  indent, " ",
-		s->ts_XPD_sent, s->ts_XAK_sent, s->ts_DC_sent, s->ts_CC_sent,
-		s->ts_ER_sent);
-
-	fprintf(stdout,
-		"\n%*sRetransmissions:\n", indent, " ");
+			/*  XXX  Same value for Dev and Dev/Avg?  */
+			for (j = 0; j <= 3; j++) {
+				printf(
+				"\t%*s%11.11s: %-11d | %-11d | %-11d | %-11d\n",
+					indent, " ",
+					name[j],
+					s->ts_rtt[j],
+					s->ts_rtt[j],
+					s->ts_rtv[j],
+					s->ts_rtv[j]);
+			}
+		}
+	}
+        if(s->ts_tpdu_rcvd || s->ts_pkt_rcvd || s->ts_recv_drop || sflag <= 1) {
+		printf(
+"\n%*sTpdus RECVD [%ld valid, %3.6f %% of total (%ld); %ld dropped]\n",
+			indent," ",
+			s->ts_tpdu_rcvd, 
+			((s->ts_pkt_rcvd > 0) ?
+				((100 * (float)s->ts_tpdu_rcvd)/(float)s->ts_pkt_rcvd)
+				: 0),
+			s->ts_pkt_rcvd,
+			s->ts_recv_drop );
+		printf("\t%*sDT  %6ld   AK  %6ld   DR  %4ld   CR  %4ld \n",
+			indent, " ",
+			s->ts_DT_rcvd, s->ts_AK_rcvd, s->ts_DR_rcvd,
+			s->ts_CR_rcvd);
+		printf("\t%*sXPD %6ld   XAK %6ld   DC  %4ld   CC  %4ld   ER  %4ld\n",
+			indent, " ",
+			s->ts_XPD_rcvd, s->ts_XAK_rcvd, s->ts_DC_rcvd,
+			s->ts_CC_rcvd, s->ts_ER_rcvd);
+	}
+        if(s->ts_tpdu_sent || s->ts_send_drop || sflag <= 1) {
+		printf("\n%*sTpdus SENT [%ld total, %ld dropped]\n",
+			indent, " ",
+			s->ts_tpdu_sent, s->ts_send_drop);
+		printf("\t%*sDT  %6ld   AK  %6ld   DR  %4ld   CR  %4ld \n",
+			indent, " ", s->ts_DT_sent, s->ts_AK_sent,
+			s->ts_DR_sent, s->ts_CR_sent);
+		printf("\t%*sXPD %6ld   XAK %6ld   DC  %4ld   CC  %4ld   ER  %4ld\n",
+			indent, " ", s->ts_XPD_sent, s->ts_XAK_sent,
+			s->ts_DC_sent, s->ts_CC_sent, s->ts_ER_sent);
+	}
+
+	if (s->ts_retrans_cr || s->ts_retrans_cc || s->ts_retrans_dr
+	    || s->ts_retrans_dt || s->ts_retrans_xpd || sflag <= 1)
+	printf("\n%*sRetransmissions:\n", indent, " ");
 #define PERCENT(X,Y) (((Y)>0)?((100 *(float)(X)) / (float) (Y)):0)
 
-	fprintf(stdout,
-	"\t%*sCR  %6ld   CC  %6ld   DR  %6ld \n", indent, " ",
-		s->ts_retrans_cr, s->ts_retrans_cc, s->ts_retrans_dr);
-	fprintf(stdout,
-	"\t%*sDT  %6ld (%5.2f%%)\n", indent, " ",
-		s->ts_retrans_dt,
-		PERCENT(s->ts_retrans_dt, s->ts_DT_sent));
-	fprintf(stdout,
-	"\t%*sXPD %6ld (%5.2f%%)\n",  indent, " ",
-		s->ts_retrans_xpd,
-		PERCENT(s->ts_retrans_xpd, s->ts_XPD_sent));
-
-
-	fprintf(stdout,
-		"\n%*sE Timers: [%6ld ticks]\n", indent, " ", s->ts_Eticks);
-	fprintf(stdout,
-		"%*s%6ld timer%s set \t%6ld timer%s expired \t%6ld timer%s cancelled\n",indent, " ",
-		s->ts_Eset, plural(s->ts_Eset),
-		s->ts_Eexpired, plural(s->ts_Eexpired),
-		s->ts_Ecan_act, plural(s->ts_Ecan_act));
-
-	fprintf(stdout,
-		"\n%*sC Timers: [%6ld ticks]\n",  indent, " ",s->ts_Cticks);
-	fprintf(stdout,
-	"%*s%6ld timer%s set \t%6ld timer%s expired \t%6ld timer%s cancelled\n",
-		indent, " ",
-		s->ts_Cset, plural(s->ts_Cset),
-		s->ts_Cexpired, plural(s->ts_Cexpired),
-		s->ts_Ccan_act, plural(s->ts_Ccan_act));
-	fprintf(stdout,
-		"%*s%6ld inactive timer%s cancelled\n", indent, " ",
-		s->ts_Ccan_inact, plural(s->ts_Ccan_inact));
-
-	fprintf(stdout,
-		"\n%*sPathological debugging activity:\n", indent, " ");
-	fprintf(stdout,
-		"\t%*s%6ld CC%s sent to zero dref\n", indent, " ",
-		s->ts_zdebug, plural(s->ts_zdebug));
+	if (s->ts_retrans_cr || s->ts_retrans_cc || s->ts_retrans_dr
+	    || sflag <= 1)
+		printf("\t%*sCR  %6ld   CC  %6ld   DR  %6ld \n", indent, " ",
+			s->ts_retrans_cr, s->ts_retrans_cc, s->ts_retrans_dr);
+	if (s->ts_retrans_dt || sflag <= 1)
+		printf("\t%*sDT  %6ld (%5.2f%%)\n", indent, " ",
+			s->ts_retrans_dt,
+			PERCENT(s->ts_retrans_dt, s->ts_DT_sent));
+	if (s->ts_retrans_xpd || sflag <= 1)
+		printf("\t%*sXPD %6ld (%5.2f%%)\n",  indent, " ",
+			s->ts_retrans_xpd,
+			PERCENT(s->ts_retrans_xpd, s->ts_XPD_sent));
+
+
+	tp(ts_Eticks, "\n%*sE Timers: [%6ld ticks]\n");
+	if (s->ts_Eset || s->ts_Eexpired || s->ts_Ecan_act || sflag <= 1)
+		printf("%*s%6ld timer%s set \t%6ld timer%s expired \t%6ld timer%s cancelled\n",
+			indent, " ",
+			s->ts_Eset, plural(s->ts_Eset),
+			s->ts_Eexpired, plural(s->ts_Eexpired),
+			s->ts_Ecan_act, plural(s->ts_Ecan_act));
+
+	tp(ts_Cticks, "\n%*sC Timers: [%6ld ticks]\n");
+	if (s->ts_Cset || s->ts_Cexpired || s->ts_Ccan_act || sflag <= 1)
+		printf("%*s%6ld timer%s set \t%6ld timer%s expired \t%6ld timer%s cancelled\n",
+			indent, " ",
+			s->ts_Cset, plural(s->ts_Cset),
+			s->ts_Cexpired, plural(s->ts_Cexpired),
+			s->ts_Ccan_act, plural(s->ts_Ccan_act));
+	tps(ts_Ccan_inact, "%*s%6ld inactive timer%s cancelled\n");
+
+	if (s->ts_zdebug || s->ts_ydebug ||s->ts_vdebug ||s->ts_ldebug || sflag <= 1)
+		printf("\n%*sPathological debugging activity:\n", indent, " ");
+	tps(ts_zdebug, "\t%*s%6ld CC%s sent to zero dref\n");
 	/* SAME LINE AS ABOVE */
-	fprintf(stdout,
-		"\t%*s%6ld random DT%s dropped\n", indent, " ",
-		s->ts_ydebug, plural(s->ts_ydebug));
-	fprintf(stdout,
-		"\t%*s%6ld illegally large XPD TPDU%s\n", indent, " ",
-		s->ts_vdebug, plural(s->ts_vdebug));
-	fprintf(stdout,
-		"\t%*s%6ld faked reneging of cdt\n", indent, " ",
-		s->ts_ldebug );
-
-	fprintf(stdout,
-		"\n%*sACK reasons:\n", indent, " ");
-	fprintf(stdout, "\t%*s%6ld not acked immediately\n", indent, " ",
-		s->ts_ackreason[_ACK_DONT_] );
-	fprintf(stdout, "\t%*s%6ld strategy==each\n", indent, " ",
-		s->ts_ackreason[_ACK_STRAT_EACH_] );
-	fprintf(stdout, "\t%*s%6ld strategy==fullwindow\n", indent, " ",
-		s->ts_ackreason[_ACK_STRAT_FULLWIN_] );
-	fprintf(stdout, "\t%*s%6ld duplicate DT\n", indent, " ",
-		s->ts_ackreason[_ACK_DUP_] );
-	fprintf(stdout, "\t%*s%6ld EOTSDU\n", indent, " ",
-		s->ts_ackreason[_ACK_EOT_] );
-	fprintf(stdout, "\t%*s%6ld reordered DT\n", indent, " ",
-		s->ts_ackreason[_ACK_REORDER_] );
-	fprintf(stdout, "\t%*s%6ld user rcvd\n", indent, " ",
-		s->ts_ackreason[_ACK_USRRCV_] );
-	fprintf(stdout, "\t%*s%6ld fcc reqd\n", indent, " ",
-		s->ts_ackreason[_ACK_FCC_] );
+	tps(ts_ydebug, "\t%*s%6ld random DT%s dropped\n");
+	tps(ts_vdebug, "\t%*s%6ld illegally large XPD TPDU%s\n");
+	tp(ts_ldebug , "\t%*s%6ld faked reneging of cdt\n");
+
+#define a_reas(f) s->ts_ackreason[f]
+
+	if (a_reas(_ACK_DONT_) || a_reas(_ACK_STRAT_EACH_)
+	    || a_reas(_ACK_STRAT_FULLWIN_) || a_reas(_ACK_DUP_)
+	    || a_reas(_ACK_EOT_) || a_reas(_ACK_REORDER_)
+	    || a_reas(_ACK_USRRCV_) || a_reas(_ACK_FCC_) || sflag <= 1)
+		printf("\n%*sACK reasons:\n", indent, " ");
+
+#define tpack(f,m) if (s->ts_ackreason[f] || sflag <= 1 ) \
+    printf(m, indent, " ", s->ts_ackreason[f])
+
+	tpack(_ACK_DONT_, "\t%*s%6ld not acked immediately\n");
+	tpack(_ACK_STRAT_EACH_, "\t%*s%6ld strategy==each\n");
+	tpack(_ACK_STRAT_FULLWIN_, "\t%*s%6ld strategy==fullwindow\n");
+	tpack(_ACK_DUP_, "\t%*s%6ld duplicate DT\n");
+	tpack(_ACK_EOT_, "\t%*s%6ld EOTSDU\n");
+	tpack(_ACK_REORDER_, "\t%*s%6ld reordered DT\n");
+	tpack(_ACK_USRRCV_, "\t%*s%6ld user rcvd\n");
+	tpack(_ACK_FCC_, "\t%*s%6ld fcc reqd\n");
 }
 #ifndef SSEL
 #define SSEL(s) ((s)->siso_tlen + TSEL(s))
>Audit-Trail:
>Unformatted: