=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/systat/netstat.c,v retrieving revision 1.18 retrieving revision 1.19 diff -c -r1.18 -r1.19 *** src/usr.bin/systat/netstat.c 2001/11/23 22:20:06 1.18 --- src/usr.bin/systat/netstat.c 2001/12/07 07:57:35 1.19 *************** *** 1,4 **** ! /* $OpenBSD: netstat.c,v 1.18 2001/11/23 22:20:06 deraadt Exp $ */ /* $NetBSD: netstat.c,v 1.3 1995/06/18 23:53:07 cgd Exp $ */ /*- --- 1,4 ---- ! /* $OpenBSD: netstat.c,v 1.19 2001/12/07 07:57:35 pvalchev Exp $ */ /* $NetBSD: netstat.c,v 1.3 1995/06/18 23:53:07 cgd Exp $ */ /*- *************** *** 38,44 **** #if 0 static char sccsid[] = "@(#)netstat.c 8.1 (Berkeley) 6/6/93"; #endif ! static char rcsid[] = "$OpenBSD: netstat.c,v 1.18 2001/11/23 22:20:06 deraadt Exp $"; #endif /* not lint */ /* --- 38,44 ---- #if 0 static char sccsid[] = "@(#)netstat.c 8.1 (Berkeley) 6/6/93"; #endif ! static char rcsid[] = "$OpenBSD: netstat.c,v 1.19 2001/12/07 07:57:35 pvalchev Exp $"; #endif /* not lint */ /* *************** *** 132,138 **** void closenetstat(w) ! WINDOW *w; { struct netinfo *p; --- 132,138 ---- void closenetstat(w) ! WINDOW *w; { struct netinfo *p; *************** *** 145,151 **** p->nif_line = -1; p = p->nif_forw; } ! if (w != NULL) { wclear(w); wrefresh(w); delwin(w); --- 145,151 ---- p->nif_line = -1; p = p->nif_forw; } ! if (w != NULL) { wclear(w); wrefresh(w); delwin(w); *************** *** 195,206 **** for (p = netcb.nif_forw; p != (struct netinfo *)&netcb; p = p->nif_forw) p->nif_seen = 0; if (protos&TCP) { ! off = NPTR(X_TCBTABLE); istcp = 1; ! } else if (protos&UDP) { ! off = NPTR(X_UDBTABLE); istcp = 0; ! } else { error("No protocols to display"); return; } --- 195,208 ---- for (p = netcb.nif_forw; p != (struct netinfo *)&netcb; p = p->nif_forw) p->nif_seen = 0; if (protos&TCP) { ! off = NPTR(X_TCBTABLE); istcp = 1; ! } ! else if (protos&UDP) { ! off = NPTR(X_UDBTABLE); istcp = 0; ! } ! else { error("No protocols to display"); return; } *************** *** 227,238 **** #endif if (!aflag) { ! if (!(inpcb.inp_flags & INP_IPV6) && ! inet_lnaof(inpcb.inp_laddr) == INADDR_ANY) continue; #ifdef INET6 ! if ((inpcb.inp_flags & INP_IPV6) && ! IN6_IS_ADDR_UNSPECIFIED(&inpcb.inp_laddr6)) continue; #endif } --- 229,240 ---- #endif if (!aflag) { ! if (!(inpcb.inp_flags & INP_IPV6) ! && inet_lnaof(inpcb.inp_laddr) == INADDR_ANY) continue; #ifdef INET6 ! if ((inpcb.inp_flags & INP_IPV6) ! && IN6_IS_ADDR_UNSPECIFIED(&inpcb.inp_laddr6)) continue; #endif } *************** *** 320,326 **** p->nif_laddr6 = inp->inp_laddr6; p->nif_faddr6 = inp->inp_faddr6; p->nif_family = AF_INET6; ! } else #endif { p->nif_laddr = inp->inp_laddr; --- 322,329 ---- p->nif_laddr6 = inp->inp_laddr6; p->nif_faddr6 = inp->inp_faddr6; p->nif_family = AF_INET6; ! } ! else #endif { p->nif_laddr = inp->inp_laddr; *************** *** 354,360 **** mvwaddstr(wnd, 0, PROTO, "Proto"); mvwaddstr(wnd, 0, RCVCC, "Recv-Q"); mvwaddstr(wnd, 0, SNDCC, "Send-Q"); ! mvwaddstr(wnd, 0, STATE, "(state)"); } void --- 357,363 ---- mvwaddstr(wnd, 0, PROTO, "Proto"); mvwaddstr(wnd, 0, RCVCC, "Recv-Q"); mvwaddstr(wnd, 0, SNDCC, "Send-Q"); ! mvwaddstr(wnd, 0, STATE, "(state)"); } void *************** *** 440,453 **** #endif mvwprintw(wnd, p->nif_line, RCVCC, "%6d", p->nif_rcvcc); mvwprintw(wnd, p->nif_line, SNDCC, "%6d", p->nif_sndcc); ! if (streq(p->nif_proto, "tcp")) { if (p->nif_state < 0 || p->nif_state >= TCP_NSTATES) mvwprintw(wnd, p->nif_line, STATE, "%d", p->nif_state); else mvwaddstr(wnd, p->nif_line, STATE, tcpstates[p->nif_state]); - } wclrtoeol(wnd); } if (lastrow < YMAX(wnd)) { --- 443,455 ---- #endif mvwprintw(wnd, p->nif_line, RCVCC, "%6d", p->nif_rcvcc); mvwprintw(wnd, p->nif_line, SNDCC, "%6d", p->nif_sndcc); ! if (streq(p->nif_proto, "tcp")) if (p->nif_state < 0 || p->nif_state >= TCP_NSTATES) mvwprintw(wnd, p->nif_line, STATE, "%d", p->nif_state); else mvwaddstr(wnd, p->nif_line, STATE, tcpstates[p->nif_state]); wclrtoeol(wnd); } if (lastrow < YMAX(wnd)) { *************** *** 518,524 **** /* * Construct an Internet address representation. ! * If the nflag has been supplied, give * numeric value, otherwise try for symbolic name. */ static const char * --- 520,526 ---- /* * Construct an Internet address representation. ! * If the nflag has been supplied, give * numeric value, otherwise try for symbolic name. */ static const char * *************** *** 553,559 **** in.s_addr = ntohl(in.s_addr); #define C(x) ((x) & 0xff) snprintf(line, sizeof line, "%u.%u.%u.%u", C(in.s_addr >> 24), ! C(in.s_addr >> 16), C(in.s_addr >> 8), C(in.s_addr)); } return (line); } --- 555,561 ---- in.s_addr = ntohl(in.s_addr); #define C(x) ((x) & 0xff) snprintf(line, sizeof line, "%u.%u.%u.%u", C(in.s_addr >> 24), ! C(in.s_addr >> 16), C(in.s_addr >> 8), C(in.s_addr)); } return (line); } *************** *** 578,584 **** sin6.sin6_len = sizeof(struct sockaddr_in6); sin6.sin6_addr = *in6; if (getnameinfo((struct sockaddr *)&sin6, sin6.sin6_len, ! line, sizeof(line), NULL, 0, flags) == 0) return line; return "?"; } --- 580,586 ---- sin6.sin6_len = sizeof(struct sockaddr_in6); sin6.sin6_addr = *in6; if (getnameinfo((struct sockaddr *)&sin6, sin6.sin6_len, ! line, sizeof(line), NULL, 0, flags) == 0) return line; return "?"; }