Changeset View
Changeset View
Standalone View
Standalone View
usr.bin/netstat/main.c
Show First 20 Lines • Show All 199 Lines • ▼ Show 20 Lines | |||||
static kvm_t *kvmd; | static kvm_t *kvmd; | ||||
static char *nlistf = NULL, *memf = NULL; | static char *nlistf = NULL, *memf = NULL; | ||||
int Aflag; /* show addresses of protocol control block */ | int Aflag; /* show addresses of protocol control block */ | ||||
int aflag; /* show all sockets (including servers) */ | int aflag; /* show all sockets (including servers) */ | ||||
static int Bflag; /* show information about bpf consumers */ | static int Bflag; /* show information about bpf consumers */ | ||||
int bflag; /* show i/f total bytes in/out */ | int bflag; /* show i/f total bytes in/out */ | ||||
int cflag; /* show congestion control */ | |||||
int dflag; /* show i/f dropped packets */ | int dflag; /* show i/f dropped packets */ | ||||
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 */ | ||||
Show All 28 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:noPp:Qq:RrSTsuWw:xz")) | while ((ch = getopt(argc, argv, "46AaBbcdF:f:ghI:iLlM:mN:noPp: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 All 11 Lines | #endif | ||||
case 'a': | case 'a': | ||||
aflag = 1; | aflag = 1; | ||||
break; | break; | ||||
case 'B': | case 'B': | ||||
Bflag = 1; | Bflag = 1; | ||||
break; | break; | ||||
case 'b': | case 'b': | ||||
bflag = 1; | bflag = 1; | ||||
break; | |||||
case 'c': | |||||
cflag = 1; | |||||
break; | break; | ||||
case 'd': | case 'd': | ||||
dflag = 1; | dflag = 1; | ||||
break; | break; | ||||
case 'F': | case 'F': | ||||
fib = strtol(optarg, &endptr, 0); | fib = strtol(optarg, &endptr, 0); | ||||
if (*endptr != '\0' || | if (*endptr != '\0' || | ||||
(fib == 0 && (errno == EINVAL || errno == ERANGE))) | (fib == 0 && (errno == EINVAL || errno == ERANGE))) | ||||
▲ Show 20 Lines • Show All 606 Lines • Show Last 20 Lines |