[BACK]Return to netstat.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / systat

Diff for /src/usr.bin/systat/netstat.c between version 1.18 and 1.19

version 1.18, 2001/11/23 22:20:06 version 1.19, 2001/12/07 07:57:35
Line 132 
Line 132 
   
 void  void
 closenetstat(w)  closenetstat(w)
         WINDOW *w;          WINDOW *w;
 {  {
         struct netinfo *p;          struct netinfo *p;
   
Line 145 
Line 145 
                 p->nif_line = -1;                  p->nif_line = -1;
                 p = p->nif_forw;                  p = p->nif_forw;
         }          }
         if (w != NULL) {          if (w != NULL) {
                 wclear(w);                  wclear(w);
                 wrefresh(w);                  wrefresh(w);
                 delwin(w);                  delwin(w);
Line 195 
Line 195 
         for (p = netcb.nif_forw; p != (struct netinfo *)&netcb; p = p->nif_forw)          for (p = netcb.nif_forw; p != (struct netinfo *)&netcb; p = p->nif_forw)
                 p->nif_seen = 0;                  p->nif_seen = 0;
         if (protos&TCP) {          if (protos&TCP) {
                 off = NPTR(X_TCBTABLE);                  off = NPTR(X_TCBTABLE);
                 istcp = 1;                  istcp = 1;
         } else if (protos&UDP) {          }
                 off = NPTR(X_UDBTABLE);          else if (protos&UDP) {
                   off = NPTR(X_UDBTABLE);
                 istcp = 0;                  istcp = 0;
         } else {          }
           else {
                 error("No protocols to display");                  error("No protocols to display");
                 return;                  return;
         }          }
Line 227 
Line 229 
 #endif  #endif
   
                 if (!aflag) {                  if (!aflag) {
                         if (!(inpcb.inp_flags & INP_IPV6) &&                          if (!(inpcb.inp_flags & INP_IPV6)
                             inet_lnaof(inpcb.inp_laddr) == INADDR_ANY)                           && inet_lnaof(inpcb.inp_laddr) == INADDR_ANY)
                                 continue;                                  continue;
 #ifdef INET6  #ifdef INET6
                         if ((inpcb.inp_flags & INP_IPV6) &&                          if ((inpcb.inp_flags & INP_IPV6)
                             IN6_IS_ADDR_UNSPECIFIED(&inpcb.inp_laddr6))                           && IN6_IS_ADDR_UNSPECIFIED(&inpcb.inp_laddr6))
                                 continue;                                  continue;
 #endif  #endif
                 }                  }
Line 320 
Line 322 
                         p->nif_laddr6 = inp->inp_laddr6;                          p->nif_laddr6 = inp->inp_laddr6;
                         p->nif_faddr6 = inp->inp_faddr6;                          p->nif_faddr6 = inp->inp_faddr6;
                         p->nif_family = AF_INET6;                          p->nif_family = AF_INET6;
                 } else                  }
                   else
 #endif  #endif
                 {                  {
                         p->nif_laddr = inp->inp_laddr;                          p->nif_laddr = inp->inp_laddr;
Line 354 
Line 357 
         mvwaddstr(wnd, 0, PROTO, "Proto");          mvwaddstr(wnd, 0, PROTO, "Proto");
         mvwaddstr(wnd, 0, RCVCC, "Recv-Q");          mvwaddstr(wnd, 0, RCVCC, "Recv-Q");
         mvwaddstr(wnd, 0, SNDCC, "Send-Q");          mvwaddstr(wnd, 0, SNDCC, "Send-Q");
         mvwaddstr(wnd, 0, STATE, "(state)");          mvwaddstr(wnd, 0, STATE, "(state)");
 }  }
   
 void  void
Line 440 
Line 443 
 #endif  #endif
                 mvwprintw(wnd, p->nif_line, RCVCC, "%6d", p->nif_rcvcc);                  mvwprintw(wnd, p->nif_line, RCVCC, "%6d", p->nif_rcvcc);
                 mvwprintw(wnd, p->nif_line, SNDCC, "%6d", p->nif_sndcc);                  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)                          if (p->nif_state < 0 || p->nif_state >= TCP_NSTATES)
                                 mvwprintw(wnd, p->nif_line, STATE, "%d",                                  mvwprintw(wnd, p->nif_line, STATE, "%d",
                                     p->nif_state);                                      p->nif_state);
                         else                          else
                                 mvwaddstr(wnd, p->nif_line, STATE,                                  mvwaddstr(wnd, p->nif_line, STATE,
                                     tcpstates[p->nif_state]);                                      tcpstates[p->nif_state]);
                 }  
                 wclrtoeol(wnd);                  wclrtoeol(wnd);
         }          }
         if (lastrow < YMAX(wnd)) {          if (lastrow < YMAX(wnd)) {
Line 518 
Line 520 
   
 /*  /*
  * Construct an Internet address representation.   * 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.   * numeric value, otherwise try for symbolic name.
  */   */
 static const char *  static const char *
Line 553 
Line 555 
                 in.s_addr = ntohl(in.s_addr);                  in.s_addr = ntohl(in.s_addr);
 #define C(x)    ((x) & 0xff)  #define C(x)    ((x) & 0xff)
                 snprintf(line, sizeof line, "%u.%u.%u.%u", C(in.s_addr >> 24),                  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);          return (line);
 }  }
Line 578 
Line 580 
         sin6.sin6_len = sizeof(struct sockaddr_in6);          sin6.sin6_len = sizeof(struct sockaddr_in6);
         sin6.sin6_addr = *in6;          sin6.sin6_addr = *in6;
         if (getnameinfo((struct sockaddr *)&sin6, sin6.sin6_len,          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 line;
         return "?";          return "?";
 }  }

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.19