Changeset View
Changeset View
Standalone View
Standalone View
usr.bin/netstat/main.c
Show First 20 Lines • Show All 208 Lines • ▼ Show 20 Lines | |||||
int gflag; /* show group (multicast) routing or stats */ | int gflag; /* show group (multicast) routing or stats */ | ||||
int hflag; /* show counters in human readable format */ | int hflag; /* show counters in human readable format */ | ||||
int iflag; /* show interfaces */ | int iflag; /* show interfaces */ | ||||
int Lflag; /* show size of listen queues */ | int Lflag; /* show size of listen queues */ | ||||
int mflag; /* show memory stats */ | int mflag; /* show memory stats */ | ||||
int noutputs = 0; /* how much outputs before we exit */ | int noutputs = 0; /* how much outputs before we exit */ | ||||
int numeric_addr; /* show addresses numerically */ | int numeric_addr; /* show addresses numerically */ | ||||
int numeric_port; /* show ports numerically */ | int numeric_port; /* show ports numerically */ | ||||
int Pflag; /* show TCP log ID */ | |||||
static int pflag; /* show given protocol */ | static int pflag; /* show given protocol */ | ||||
static int Qflag; /* show netisr information */ | static int Qflag; /* show netisr information */ | ||||
int rflag; /* show routing tables (or routing stats) */ | int rflag; /* show routing tables (or routing stats) */ | ||||
int Rflag; /* show flow / RSS statistics */ | int Rflag; /* show flow / RSS statistics */ | ||||
int sflag; /* show protocol statistics */ | int sflag; /* show protocol statistics */ | ||||
int Wflag; /* wide display */ | int Wflag; /* wide display */ | ||||
int Tflag; /* TCP Information */ | int Tflag; /* TCP Information */ | ||||
int xflag; /* extra information, includes all socket buffer info */ | int xflag; /* extra information, includes all socket buffer info */ | ||||
Show All 17 Lines | main(int argc, char *argv[]) | ||||
bool first = true; | bool first = true; | ||||
af = AF_UNSPEC; | af = AF_UNSPEC; | ||||
argc = xo_parse_args(argc, argv); | argc = xo_parse_args(argc, argv); | ||||
if (argc < 0) | if (argc < 0) | ||||
exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | ||||
while ((ch = getopt(argc, argv, "46AaBbdF:f:ghI:iLlM:mN:np:Qq:RrSTsuWw:xz")) | while ((ch = getopt(argc, argv, "46AaBbdF:f:ghI:iLlM:mN:nPp:Qq:RrSTsuWw:xz")) | ||||
!= -1) | != -1) | ||||
switch(ch) { | switch(ch) { | ||||
case '4': | case '4': | ||||
#ifdef INET | #ifdef INET | ||||
af = AF_INET; | af = AF_INET; | ||||
#else | #else | ||||
errx(1, "IPv4 support is not compiled in"); | errx(1, "IPv4 support is not compiled in"); | ||||
#endif | #endif | ||||
▲ Show 20 Lines • Show All 79 Lines • ▼ Show 20 Lines | #endif | ||||
case 'm': | case 'm': | ||||
mflag = 1; | mflag = 1; | ||||
break; | break; | ||||
case 'N': | case 'N': | ||||
nlistf = optarg; | nlistf = optarg; | ||||
break; | break; | ||||
case 'n': | case 'n': | ||||
numeric_addr = numeric_port = 1; | numeric_addr = numeric_port = 1; | ||||
break; | |||||
case 'P': | |||||
Pflag = 1; | |||||
break; | break; | ||||
case 'p': | case 'p': | ||||
if ((tp = name2protox(optarg)) == NULL) { | if ((tp = name2protox(optarg)) == NULL) { | ||||
xo_errx(1, "%s: unknown or uninstrumented " | xo_errx(1, "%s: unknown or uninstrumented " | ||||
"protocol", optarg); | "protocol", optarg); | ||||
} | } | ||||
pflag = 1; | pflag = 1; | ||||
break; | break; | ||||
▲ Show 20 Lines • Show All 521 Lines • Show Last 20 Lines |