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:
parent
eb064071a1
commit
794313942d
@ -36,7 +36,7 @@
|
|||||||
static char sccsid[] = "@(#)netcmds.c 8.1 (Berkeley) 6/6/93";
|
static char sccsid[] = "@(#)netcmds.c 8.1 (Berkeley) 6/6/93";
|
||||||
*/
|
*/
|
||||||
static const char rcsid[] =
|
static const char rcsid[] =
|
||||||
"$Id$";
|
"$Id: netcmds.c,v 1.6 1997/02/22 19:57:16 peter Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -83,8 +83,14 @@ netcmd(cmd, args)
|
|||||||
char *cmd, *args;
|
char *cmd, *args;
|
||||||
{
|
{
|
||||||
|
|
||||||
if (prefix(cmd, "tcp") || prefix(cmd, "udp")) {
|
if (prefix(cmd, "proto")) {
|
||||||
selectproto(cmd);
|
if (*args == '\0') {
|
||||||
|
move(CMDLINE, 0);
|
||||||
|
clrtoeol();
|
||||||
|
addstr("which proto?");
|
||||||
|
} else if (!selectproto(args)) {
|
||||||
|
error("%s: Unknown protocol.", args);
|
||||||
|
}
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
if (prefix(cmd, "ignore") || prefix(cmd, "display")) {
|
if (prefix(cmd, "ignore") || prefix(cmd, "display")) {
|
||||||
@ -166,15 +172,17 @@ static int
|
|||||||
selectproto(proto)
|
selectproto(proto)
|
||||||
char *proto;
|
char *proto;
|
||||||
{
|
{
|
||||||
int new = protos;
|
|
||||||
|
|
||||||
if (proto == 0 || streq(proto, "all"))
|
if (proto == 0 || streq(proto, "all"))
|
||||||
new = TCP|UDP;
|
protos = TCP | UDP;
|
||||||
else if (streq(proto, "tcp"))
|
else if (streq(proto, "tcp"))
|
||||||
new = TCP;
|
protos = TCP;
|
||||||
else if (streq(proto, "udp"))
|
else if (streq(proto, "udp"))
|
||||||
new = UDP;
|
protos = UDP;
|
||||||
return (new != protos, protos = new);
|
else
|
||||||
|
return (0);
|
||||||
|
|
||||||
|
return (protos);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -396,14 +396,15 @@ Toggle the displaying of server processes awaiting requests (this
|
|||||||
is the equivalent of the
|
is the equivalent of the
|
||||||
.Fl a
|
.Fl a
|
||||||
flag to
|
flag to
|
||||||
.Ar netstat 1 ) .
|
.Xr netstat 1 ) .
|
||||||
.It Cm numbers
|
.It Cm numbers
|
||||||
Display network addresses numerically.
|
Display network addresses numerically.
|
||||||
.It Cm names
|
.It Cm names
|
||||||
Display network addresses symbolically.
|
Display network addresses symbolically.
|
||||||
.It Ar protocol
|
.It Cm proto Ar protocol
|
||||||
Display only network connections using the indicated protocol
|
Display only network connections using the indicated
|
||||||
(currently either ``tcp'' or ``udp'').
|
.Ar protocol .
|
||||||
|
Supported protocols are ``tcp'', ``udp'', and ``all''.
|
||||||
.It Cm ignore Op Ar items
|
.It Cm ignore Op Ar items
|
||||||
Do not display information about connections associated with
|
Do not display information about connections associated with
|
||||||
the specified hosts or ports. Hosts and ports may be specified
|
the specified hosts or ports. Hosts and ports may be specified
|
||||||
|
Loading…
x
Reference in New Issue
Block a user