diff options
author | steve <steve@FreeBSD.org> | 1997-12-04 03:44:46 +0000 |
---|---|---|
committer | steve <steve@FreeBSD.org> | 1997-12-04 03:44:46 +0000 |
commit | 6136cd11ff8b2721f7ec0f1d33a221cc30ff5666 (patch) | |
tree | 7c09304826c74f0f3b79ae9a936a98dfd16ae4d5 /usr.bin/systat/netcmds.c | |
parent | d06debb088318cefea304bdcc695e7a060a6cdd2 (diff) | |
download | FreeBSD-src-6136cd11ff8b2721f7ec0f1d33a221cc30ff5666.zip FreeBSD-src-6136cd11ff8b2721f7ec0f1d33a221cc30ff5666.tar.gz |
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>
Diffstat (limited to 'usr.bin/systat/netcmds.c')
-rw-r--r-- | usr.bin/systat/netcmds.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/usr.bin/systat/netcmds.c b/usr.bin/systat/netcmds.c index 94dc3ca..1427213 100644 --- a/usr.bin/systat/netcmds.c +++ b/usr.bin/systat/netcmds.c @@ -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 |