/*
- * Copyright (c) 2008-2014 Apple Inc. All rights reserved.
+ * Copyright (c) 2008-2015 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
{ NULL, NULL, NULL, NULL, 0 }
};
+struct protox nstatprotox[] = {
+ { NULL, print_nstat_stats, NULL, "nstat", 0 },
+ { NULL, NULL, NULL, NULL, 0 }
+};
+
+struct protox ipcprotox[] = {
+ { NULL, print_extbkidle_stats, NULL, "xbkidle", 0 },
+ { NULL, NULL, NULL, NULL, 0 }
+};
+
+
struct protox *protoprotox[] = {
protox,
#ifdef INET6
pfkeyprotox,
#endif
systmprotox,
+ nstatprotox,
+ ipcprotox,
NULL
};
int Rflag; /* show reachability information */
int rflag; /* show routing tables (or routing stats) */
int sflag; /* show protocol statistics */
+int Sflag; /* show additional i/f link status */
int tflag; /* show i/f watchdog timers */
int vflag; /* more verbose */
int Wflag; /* wide display */
af = AF_UNSPEC;
- while ((ch = getopt(argc, argv, "Aabc:dFf:gI:iLlmnP:p:qQrRstuvWw:x")) != -1)
+ while ((ch = getopt(argc, argv, "Aabc:dFf:gI:ikLlmnP:p:qQrRsStuvWw:x")) != -1)
switch(ch) {
case 'A':
Aflag = 1;
else if (strcmp(optarg, "pfkey") == 0)
af = PF_KEY;
#endif /*INET6*/
- else if (strcmp(optarg, "unix") == 0)
- af = AF_UNIX;
- else if (strcmp(optarg, "systm") == 0)
- af = AF_SYSTEM;
+ else if (strcmp(optarg, "unix") == 0)
+ af = AF_UNIX;
+ else if (strcmp(optarg, "systm") == 0)
+ af = AF_SYSTEM;
else {
errx(1, "%s: unknown address family", optarg);
}
case 's':
++sflag;
break;
+ case 'S':
+ Sflag = 1;
+ break;
case 't':
tflag = 1;
break;
mbpr();
exit(0);
}
- if (iflag && !sflag && !gflag && !qflag && !Qflag) {
+ if (iflag && !sflag && !Sflag && !gflag && !qflag && !Qflag) {
if (Rflag)
intpr_ri(NULL);
else
}
exit(0);
}
+ if (Sflag) {
+ if (interface == NULL) {
+ fprintf(stderr, "additional link status option"
+ " requires interface name\n");
+ } else {
+ print_link_status(interface);
+ }
+ exit(0);
+ }
#if defined(__APPLE__)
if (gflag) {
if ((af == AF_SYSTEM || af == AF_UNSPEC) && !Lflag)
for (tp = systmprotox; tp->pr_name; tp++)
printproto(tp, tp->pr_name);
-
+#if TARGET_OS_IPHONE
+ if (af == AF_UNSPEC && !Lflag)
+ for (tp = nstatprotox; tp->pr_name; tp++)
+ printproto(tp, tp->pr_name);
+#endif /* TARGET_OS_IPHONE */
+
+ if (af == AF_UNSPEC && !Lflag)
+ for (tp = ipcprotox; tp->pr_name; tp++)
+ printproto(tp, tp->pr_name);
+
#ifdef SRVCACHE
_serv_cache_close();
#endif
char *
plural(int n)
{
- return (n != 1 ? "s" : "");
+ return (n > 1 ? "s" : "");
}
char *
plurales(int n)
{
- return (n != 1 ? "es" : "");
+ return (n > 1 ? "es" : "");
}
char *
pluralies(int n)
{
- return (n != 1 ? "ies" : "y");
+ return (n > 1 ? "ies" : "y");
}
/*
#define NETSTAT_USAGE "\
Usage: netstat [-AaLlnW] [-f address_family | -p protocol]\n\
netstat [-gilns] [-f address_family]\n\
- netstat -i | -I interface [-w wait] [-abdgRt]\n\
+ netstat -i | -I interface [-w wait] [-abdgRtS]\n\
netstat -s [-s] [-f address_family | -p protocol] [-w wait]\n\
netstat -i | -I interface -s [-f address_family | -p protocol]\n\
netstat -m [-m]\n\