ref: 7c22230886134121893f02ee283da85f3a6807e6
parent: df8fccc05de108237ee36fa493f987429c00c7f7
author: 9ferno <gophone2015@gmail.com>
date: Tue Sep 7 08:48:31 EDT 2021
work on /net.alt too
--- a/appl/cmd/netstat.b
+++ b/appl/cmd/netstat.b
@@ -15,15 +15,25 @@
stderr: ref FD;
-init(nil: ref Context, nil: list of string)
+usage()
{
+ sys->fprint(sys->fildes(2), "Usage: netstat [/net.alt]\n");
+ raise "fail:usage";
+}
+
+init(nil: ref Context, args: list of string)
+{
sys = load Sys Sys->PATH;
stderr = fildes(2);
- nstat("/net/tcp", 1);
- nstat("/net/udp", 1);
- nstat("/net/il", 0);
+ net := "/net";
+ args = tl args;
+ if(len args == 1)
+ net = hd args;
+ nstat(net+"/tcp", 1);
+ nstat(net+"/udp", 1);
+ nstat(net+"/il", 0);
}
nstat(file: string, whine: int)