+ /*
+ * If no control blocks have been specified, figure
+ * out how many distinct one we have and summarize
+ * them in tcp_pcbs for sorting the trace records
+ * below.
+ */
+ if (npcbs == 0) {
+ for (i = 0; i < TCP_NDEBUG; i++) {
+ register int j;
+ register struct tcp_debug *td = &tcp_debug[i];
+
+ if (td->td_tcb == 0)
+ continue;
+ for (j = 0; j < npcbs; j++)
+ if (tcp_pcbs[j] == td->td_tcb)
+ break;
+ if (j >= npcbs)
+ tcp_pcbs[npcbs++] = td->td_tcb;
+ }
+ }
+ qsort(tcp_pcbs, npcbs, sizeof (caddr_t), numeric);
+ if (jflag) {
+ char *cp = "";
+
+ for (i = 0; i < npcbs; i++) {
+ printf("%s%x", cp, tcp_pcbs[i]);
+ cp = ", ";
+ }
+ if (*cp)
+ putchar('\n');
+ exit(0);
+ }
+ for (i = 0; i < npcbs; i++) {
+ printf("\n%x:\n", tcp_pcbs[i]);
+ dotrace(tcp_pcbs[i]);
+ }
+ exit(0);
+}