summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2004-04-01 07:55:18 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2004-04-01 07:55:18 +0000
commit7595c3e2d1e4adbe6b2c8cc82a483584e6054001 (patch)
treec442ff86bb90139c7ef2d22a1dafc5043a4a0fa3 /usr.bin
parent28203f4bcaa37de26135530af5e9bdc71aabb52a (diff)
change -p to restrict output to protocol (not just for -s);
ok deraadt@, hshoexer@, tdeval@, jmc@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/netstat/main.c10
-rw-r--r--usr.bin/netstat/netstat.113
2 files changed, 11 insertions, 12 deletions
diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c
index 062a96b6380..c7d5c31150b 100644
--- a/usr.bin/netstat/main.c
+++ b/usr.bin/netstat/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.44 2004/03/13 22:02:13 deraadt Exp $ */
+/* $OpenBSD: main.c,v 1.45 2004/04/01 07:55:17 markus Exp $ */
/* $NetBSD: main.c,v 1.9 1996/05/07 02:55:02 thorpej Exp $ */
/*
@@ -40,7 +40,7 @@ char copyright[] =
#if 0
static char sccsid[] = "from: @(#)main.c 8.4 (Berkeley) 3/1/94";
#else
-static char *rcsid = "$OpenBSD: main.c,v 1.44 2004/03/13 22:02:13 deraadt Exp $";
+static char *rcsid = "$OpenBSD: main.c,v 1.45 2004/04/01 07:55:17 markus Exp $";
#endif
#endif /* not lint */
@@ -463,11 +463,7 @@ main(int argc, char *argv[])
exit(0);
}
if (pflag) {
- if (tp->pr_stats)
- (*tp->pr_stats)(nl[tp->pr_sindex].n_value,
- tp->pr_name);
- else
- printf("%s: no stats routine\n", tp->pr_name);
+ printproto(tp, tp->pr_name);
exit(0);
}
/*
diff --git a/usr.bin/netstat/netstat.1 b/usr.bin/netstat/netstat.1
index f2ab66076df..1ad750adbd3 100644
--- a/usr.bin/netstat/netstat.1
+++ b/usr.bin/netstat/netstat.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: netstat.1,v 1.34 2003/11/28 10:05:43 jmc Exp $
+.\" $OpenBSD: netstat.1,v 1.35 2004/04/01 07:55:17 markus Exp $
.\" $NetBSD: netstat.1,v 1.11 1995/10/03 21:42:43 thorpej Exp $
.\"
.\" Copyright (c) 1983, 1990, 1992, 1993
@@ -54,6 +54,7 @@
.Op Fl N Ar system
.Op Fl w Ar wait
.Nm netstat
+.Op Fl s
.Op Fl M Ar core
.Op Fl N Ar system
.Op Fl p Ar protocol
@@ -201,16 +202,18 @@ interprets addresses and attempts to display them
symbolically).
This option may be used with any of the display formats.
.It Fl p Ar protocol
-Show statistics about
+Restrict the output to
.Ar protocol ,
which is either a well-known name for a protocol or an alias for it.
Some protocol names and aliases are listed in the file
.Pa /etc/protocols .
-A null response typically means that there are no interesting numbers to
-report.
The program will complain if
.Ar protocol
-is unknown or if there is no statistics routine for it.
+is unknown.
+If the
+.Fl s
+option is specified, the per-protocol statistics are displayed.
+Otherwise the states of the matching sockets are shown.
.It Fl q
Only show interfaces that have seen packets (or bytes if
.Fl b