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.
This commit is contained in:
Robert Griebl
2002-05-14 23:03:23 +00:00
parent aa385d4015
commit 820098fd61
2 changed files with 70 additions and 23 deletions

View File

@@ -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;