diff options
author | Robert Griebl | 2002-05-14 23:03:23 +0000 |
---|---|---|
committer | Robert Griebl | 2002-05-14 23:03:23 +0000 |
commit | 820098fd61e9c2ed7836fd61b2824d2fb4b22861 (patch) | |
tree | abd7c6779d72d816a3c309fb2b70dbf5f598f1f0 /networking/netstat.c | |
parent | aa385d40156d909ef51be4d52fa90b5c24081a88 (diff) | |
download | busybox-820098fd61e9c2ed7836fd61b2824d2fb4b22861.zip busybox-820098fd61e9c2ed7836fd61b2824d2fb4b22861.tar.gz |
This patch adds -e (extended information) to route and -r/-e (show routing
tables/extended information) to netstat.
This makes them behave (more) like their GNU counterparts.
Diffstat (limited to 'networking/netstat.c')
-rw-r--r-- | networking/netstat.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/networking/netstat.c b/networking/netstat.c index 28ae9bc..b083b0d 100644 --- a/networking/netstat.c +++ b/networking/netstat.c @@ -33,6 +33,10 @@ #include "inet_common.h" #include "busybox.h" +#ifdef CONFIG_ROUTE +extern void displayroutes(int noresolve, int netstatfmt); +#endif + #define NETSTAT_CONNECTED 0x01 #define NETSTAT_LISTENING 0x02 #define NETSTAT_NUMERIC 0x04 @@ -462,7 +466,8 @@ int netstat_main(int argc, char **argv) { int opt; int new_flags=0; - while ((opt = getopt(argc, argv, "lantuwx")) != -1) + int showroute = 0, extended = 0; + while ((opt = getopt(argc, argv, "laenrtuwx")) != -1) switch (opt) { case 'l': flags &= ~NETSTAT_CONNECTED; @@ -474,6 +479,12 @@ int netstat_main(int argc, char **argv) case 'n': flags |= NETSTAT_NUMERIC; break; + case 'r': + showroute = 1; + break; + case 'e': + extended = 1; + break; case 't': new_flags |= NETSTAT_TCP; break; @@ -489,6 +500,16 @@ int netstat_main(int argc, char **argv) default: show_usage(); } + if ( showroute ) { +#ifdef CONFIG_ROUTE + displayroutes ( flags & NETSTAT_NUMERIC, !extended ); + return 0; +#else + printf( "-r (display routing table) is not compiled in.\n" ); + return 1; +#endif + } + if (new_flags) { flags &= ~(NETSTAT_TCP|NETSTAT_UDP|NETSTAT_RAW|NETSTAT_UNIX); flags |= new_flags; |