summaryrefslogtreecommitdiffstats
path: root/usr.bin/netstat/main.c
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2001-03-15 20:46:04 +0000
committerdes <des@FreeBSD.org>2001-03-15 20:46:04 +0000
commitcd8d72036779073e9a559040e5b29558621cdc99 (patch)
tree3f4a6ecbb973b94f218b84036441521df917e981 /usr.bin/netstat/main.c
parent5848bb858cf31a463c79467310f42ac79bb149a5 (diff)
downloadFreeBSD-src-cd8d72036779073e9a559040e5b29558621cdc99.zip
FreeBSD-src-cd8d72036779073e9a559040e5b29558621cdc99.tar.gz
Add a -W flag that tells netstat not to truncate addresses even if they are
too long for the column they're printed in. Move variable definitions out of netstat.h and into main.c. Clean up some warnings.
Diffstat (limited to 'usr.bin/netstat/main.c')
-rw-r--r--usr.bin/netstat/main.c32
1 files changed, 29 insertions, 3 deletions
diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c
index 5c23f3c..7a11793 100644
--- a/usr.bin/netstat/main.c
+++ b/usr.bin/netstat/main.c
@@ -290,7 +290,30 @@ static struct protox *name2protox __P((char *));
static struct protox *knownname __P((char *));
static kvm_t *kvmd;
-char *nlistf = NULL, *memf = NULL;
+static char *nlistf = NULL, *memf = NULL;
+
+int Aflag; /* show addresses of protocol control block */
+int aflag; /* show all sockets (including servers) */
+int bflag; /* show i/f total bytes in/out */
+int dflag; /* show i/f dropped packets */
+int gflag; /* show group (multicast) routing or stats */
+int iflag; /* show interfaces */
+int lflag; /* show routing table with use and ref */
+int Lflag; /* show size of listen queues */
+int mflag; /* show memory stats */
+int nflag; /* show addresses numerically */
+int pflag; /* show given protocol */
+int rflag; /* show routing tables (or routing stats) */
+int sflag; /* show protocol statistics */
+int tflag; /* show i/f watchdog timers */
+int Wflag; /* wide display */
+
+int interval; /* repeat interval for i/f stats */
+
+char *interface; /* desired i/f for stats, or NULL for all i/fs */
+int unit; /* unit number for above */
+
+int af; /* address family */
int
main(argc, argv)
@@ -302,7 +325,7 @@ main(argc, argv)
af = AF_UNSPEC;
- while ((ch = getopt(argc, argv, "Aabdf:ghI:lLiM:mN:np:rstuw:")) != -1)
+ while ((ch = getopt(argc, argv, "Aabdf:ghI:lLiM:mN:np:rstuWw:")) != -1)
switch(ch) {
case 'A':
Aflag = 1;
@@ -402,6 +425,9 @@ main(argc, argv)
case 'u':
af = AF_UNIX;
break;
+ case 'W':
+ Wflag = 1;
+ break;
case 'w':
interval = atoi(optarg);
iflag = 1;
@@ -696,7 +722,7 @@ static void
usage()
{
(void)fprintf(stderr, "%s\n%s\n%s\n%s\n",
-"usage: netstat [-AaLln] [-f address_family] [-M core] [-N system]",
+"usage: netstat [-AaLlnW] [-f address_family] [-M core] [-N system]",
" netstat [-abdghilmnrs] [-f address_family] [-M core] [-N system]",
" netstat [-bdn] [-I interface] [-M core] [-N system] [-w wait]",
" netstat [-M core] [-N system] [-p protocol]");
OpenPOWER on IntegriCloud