Use 'proto <tcp|udp|all>' to select the protocol to display

in netstat-mode to avoid a conflict with tcp-mode.  Also
while documenting this new feature in the manpage, fix a
minor display nit.

PR:		5159
Submitted by:	Sergei Chechetkin <csl@whale.sunbay.crimea.ua>
This commit is contained in:
steve 1997-12-04 03:44:46 +00:00
parent 67ce829aa2
commit f64f31e604
2 changed files with 21 additions and 12 deletions

View File

@ -36,7 +36,7 @@
static char sccsid[] = "@(#)netcmds.c 8.1 (Berkeley) 6/6/93";
*/
static const char rcsid[] =
"$Id$";
"$Id: netcmds.c,v 1.6 1997/02/22 19:57:16 peter Exp $";
#endif /* not lint */
/*
@ -83,8 +83,14 @@ netcmd(cmd, args)
char *cmd, *args;
{
if (prefix(cmd, "tcp") || prefix(cmd, "udp")) {
selectproto(cmd);
if (prefix(cmd, "proto")) {
if (*args == '\0') {
move(CMDLINE, 0);
clrtoeol();
addstr("which proto?");
} else if (!selectproto(args)) {
error("%s: Unknown protocol.", args);
}
return (1);
}
if (prefix(cmd, "ignore") || prefix(cmd, "display")) {
@ -166,15 +172,17 @@ static int
selectproto(proto)
char *proto;
{
int new = protos;
if (proto == 0 || streq(proto, "all"))
new = TCP|UDP;
protos = TCP | UDP;
else if (streq(proto, "tcp"))
new = TCP;
protos = TCP;
else if (streq(proto, "udp"))
new = UDP;
return (new != protos, protos = new);
protos = UDP;
else
return (0);
return (protos);
}
static void

View File

@ -396,14 +396,15 @@ Toggle the displaying of server processes awaiting requests (this
is the equivalent of the
.Fl a
flag to
.Ar netstat 1 ) .
.Xr netstat 1 ) .
.It Cm numbers
Display network addresses numerically.
.It Cm names
Display network addresses symbolically.
.It Ar protocol
Display only network connections using the indicated protocol
(currently either ``tcp'' or ``udp'').
.It Cm proto Ar protocol
Display only network connections using the indicated
.Ar protocol .
Supported protocols are ``tcp'', ``udp'', and ``all''.
.It Cm ignore Op Ar items
Do not display information about connections associated with
the specified hosts or ports. Hosts and ports may be specified