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

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

version 1.18, 1999/10/29 03:26:40 version 1.19, 1999/12/08 12:30:17
Line 153 
Line 153 
         { "_ddpcb"},          { "_ddpcb"},
 #define N_ETHERIPSTAT   41  #define N_ETHERIPSTAT   41
         { "_etheripstat"},          { "_etheripstat"},
   #define N_IP6STAT       42
           { "_ip6stat" },
   #define N_ICMP6STAT     43
           { "_icmp6stat" },
   #define N_IPSECSTAT     44
           { "_ipsecstat" },
   #define N_IPSEC6STAT    45
           { "_ipsec6stat" },
   #define N_PIM6STAT      46
           { "_pim6stat" },
   #define N_MRT6PROTO     47
           { "_ip6_mrtproto" },
   #define N_MRT6STAT      48
           { "_mrt6stat" },
   #define N_MF6CTABLE     49
           { "_mf6ctable" },
   #define N_MIF6TABLE     50
           { "_mif6table" },
         { ""},          { ""},
 };  };
   
Line 186 
Line 204 
           0,            0 }            0,            0 }
 };  };
   
   #ifdef INET6
   struct protox ip6protox[] = {
           { -1,           N_IP6STAT,      1,      0,
             ip6_stats,    "ip6" },
           { -1,           N_ICMP6STAT,    1,      0,
             icmp6_stats,  "icmp6" },
           { -1,           N_PIM6STAT,     1,      0,
             pim6_stats,   "pim6" },
           { -1,           -1,             0,      0,
             0,            0 }
   };
   #endif
   
 struct protox ipxprotox[] = {  struct protox ipxprotox[] = {
         { N_IPX,        N_IPXSTAT,      1,      ipxprotopr,          { N_IPX,        N_IPXSTAT,      1,      ipxprotopr,
           ipx_stats,    "ipx" },            ipx_stats,    "ipx" },
Line 228 
Line 259 
           0,            0 }            0,            0 }
 };  };
   
   #ifndef INET6
 struct protox *protoprotox[] = { protox, ipxprotox, nsprotox, isoprotox, atalkprotox, NULL };  struct protox *protoprotox[] = { protox, ipxprotox, nsprotox, isoprotox, atalkprotox, NULL };
   #else
   struct protox *protoprotox[] = { protox, ip6protox, ipxprotox, nsprotox, isoprotox, atalkprotox, NULL };
   #endif
   
 static void printproto __P((struct protox *, char *));  static void printproto __P((struct protox *, char *));
 static void usage __P((void));  static void usage __P((void));
Line 245 
Line 280 
         extern char *optarg;          extern char *optarg;
         extern int optind;          extern int optind;
         register struct protoent *p;          register struct protoent *p;
         register struct protox *tp;     /* for printing cblocks & stats */          register struct protox *tp = NULL; /* for printing cblocks & stats */
         int ch;          int ch;
         char *nlistf = NULL, *memf = NULL;          char *nlistf = NULL, *memf = NULL;
         char buf[_POSIX2_LINE_MAX];          char buf[_POSIX2_LINE_MAX];
   
         af = AF_UNSPEC;          af = AF_UNSPEC;
   
         while ((ch = getopt(argc, argv, "Aadf:gI:iM:mN:np:rstuvw:")) != -1)          while ((ch = getopt(argc, argv, "Aadf:gI:ilM:mN:np:rstuvw:")) != -1)
                 switch(ch) {                  switch(ch) {
                 case 'A':                  case 'A':
                         Aflag = 1;                          Aflag = 1;
Line 266 
Line 301 
                 case 'f':                  case 'f':
                         if (strcmp(optarg, "inet") == 0)                          if (strcmp(optarg, "inet") == 0)
                                 af = AF_INET;                                  af = AF_INET;
                           else if (strcmp(optarg, "inet6") == 0)
                                   af = AF_INET6;
                         else if (strcmp(optarg, "local") == 0)                          else if (strcmp(optarg, "local") == 0)
                                 af = AF_LOCAL;                                  af = AF_LOCAL;
                         else if (strcmp(optarg, "unix") == 0)                          else if (strcmp(optarg, "unix") == 0)
Line 297 
Line 334 
                 case 'i':                  case 'i':
                         iflag = 1;                          iflag = 1;
                         break;                          break;
                   case 'l':
                           lflag = 1;
                           break;
                 case 'M':                  case 'M':
                         memf = optarg;                          memf = optarg;
                         break;                          break;
Line 417 
Line 457 
                 exit(0);                  exit(0);
         }          }
         if (gflag) {          if (gflag) {
                 if (sflag)                  if (sflag) {
                         mrt_stats(nl[N_MRTPROTO].n_value,                          if (af == AF_INET || af == AF_UNSPEC)
                             nl[N_MRTSTAT].n_value);                                  mrt_stats(nl[N_MRTPROTO].n_value,
                 else                                      nl[N_MRTSTAT].n_value);
                         mroutepr(nl[N_MRTPROTO].n_value,  #ifdef INET6
                             nl[N_MFCHASHTBL].n_value,                          if (af == AF_INET6 || af == AF_UNSPEC)
                             nl[N_MFCHASH].n_value,                                  mrt6_stats(nl[N_MRT6PROTO].n_value,
                             nl[N_VIFTABLE].n_value);                                      nl[N_MRT6STAT].n_value);
   #endif
                   }
                   else {
                           if (af == AF_INET || af == AF_UNSPEC)
                                   mroutepr(nl[N_MRTPROTO].n_value,
                                       nl[N_MFCHASHTBL].n_value,
                                       nl[N_MFCHASH].n_value,
                                       nl[N_VIFTABLE].n_value);
   #ifdef INET6
                           if (af == AF_INET6 || af == AF_UNSPEC)
                                   mroute6pr(nl[N_MRT6PROTO].n_value,
                                       nl[N_MF6CTABLE].n_value,
                                       nl[N_MIF6TABLE].n_value);
   #endif
                   }
                 exit(0);                  exit(0);
         }          }
         if (af == AF_INET || af == AF_UNSPEC) {          if (af == AF_INET || af == AF_UNSPEC) {
Line 441 
Line 496 
                 }                  }
                 endprotoent();                  endprotoent();
         }          }
   #ifdef INET6
           if (af == AF_INET6 || af == AF_UNSPEC)
                   for (tp = ip6protox; tp->pr_name; tp++)
                           printproto(tp, tp->pr_name);
   #endif
         if (af == AF_IPX || af == AF_UNSPEC)          if (af == AF_IPX || af == AF_UNSPEC)
                 for (tp = ipxprotox; tp->pr_name; tp++)                  for (tp = ipxprotox; tp->pr_name; tp++)
                         printproto(tp, tp->pr_name);                          printproto(tp, tp->pr_name);

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