=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/systat/netstat.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- src/usr.bin/systat/netstat.c 2001/11/19 19:02:16 1.17 +++ src/usr.bin/systat/netstat.c 2001/11/23 22:20:06 1.18 @@ -1,4 +1,4 @@ -/* $OpenBSD: netstat.c,v 1.17 2001/11/19 19:02:16 mpech Exp $ */ +/* $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 $ */ /*- @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)netstat.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$OpenBSD: netstat.c,v 1.17 2001/11/19 19:02:16 mpech Exp $"; +static char rcsid[] = "$OpenBSD: netstat.c,v 1.18 2001/11/23 22:20:06 deraadt Exp $"; #endif /* not lint */ /* @@ -132,7 +132,7 @@ void closenetstat(w) - WINDOW *w; + WINDOW *w; { struct netinfo *p; @@ -145,7 +145,7 @@ p->nif_line = -1; p = p->nif_forw; } - if (w != NULL) { + if (w != NULL) { wclear(w); wrefresh(w); delwin(w); @@ -195,14 +195,12 @@ for (p = netcb.nif_forw; p != (struct netinfo *)&netcb; p = p->nif_forw) p->nif_seen = 0; if (protos&TCP) { - off = NPTR(X_TCBTABLE); + off = NPTR(X_TCBTABLE); istcp = 1; - } - else if (protos&UDP) { - off = NPTR(X_UDBTABLE); + } else if (protos&UDP) { + off = NPTR(X_UDBTABLE); istcp = 0; - } - else { + } else { error("No protocols to display"); return; } @@ -229,12 +227,12 @@ #endif if (!aflag) { - if (!(inpcb.inp_flags & INP_IPV6) - && inet_lnaof(inpcb.inp_laddr) == INADDR_ANY) + 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)) + if ((inpcb.inp_flags & INP_IPV6) && + IN6_IS_ADDR_UNSPECIFIED(&inpcb.inp_laddr6)) continue; #endif } @@ -322,8 +320,7 @@ p->nif_laddr6 = inp->inp_laddr6; p->nif_faddr6 = inp->inp_faddr6; p->nif_family = AF_INET6; - } - else + } else #endif { p->nif_laddr = inp->inp_laddr; @@ -357,7 +354,7 @@ mvwaddstr(wnd, 0, PROTO, "Proto"); mvwaddstr(wnd, 0, RCVCC, "Recv-Q"); mvwaddstr(wnd, 0, SNDCC, "Send-Q"); - mvwaddstr(wnd, 0, STATE, "(state)"); + mvwaddstr(wnd, 0, STATE, "(state)"); } void @@ -443,13 +440,14 @@ #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 (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)) { @@ -520,7 +518,7 @@ /* * Construct an Internet address representation. - * If the nflag has been supplied, give + * If the nflag has been supplied, give * numeric value, otherwise try for symbolic name. */ static const char * @@ -555,7 +553,7 @@ 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)); + C(in.s_addr >> 16), C(in.s_addr >> 8), C(in.s_addr)); } return (line); } @@ -580,7 +578,7 @@ 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) + line, sizeof(line), NULL, 0, flags) == 0) return line; return "?"; }