[PATCH] netstat: fix -r usage

Bob Dunlop bob.dunlop at xyzzy.org.uk
Tue Oct 26 09:42:34 UTC 2010


Building with CONFIG_NETSTAT but not CONFIG_ROUTE you get the following
incorrect usage message:

# netstat -r
netstat: invalid option -- 'r'
BusyBox v1.17.1 (2010-10-26 10:22:47 BST) multi-call binary.

Usage: netstat [-laentuwxrWp]

Display networking information

Options:
	-l	Display listening server sockets
	-a	Display all sockets (default: connected)
	-e	Display other/more information
	-n	Don't resolve names
	-t	Tcp sockets
	-u	Udp sockets
	-w	Raw sockets
	-x	Unix sockets
	-r	Display routing table
	-W	Display with no column truncation
	-p	Display PID/Program name for sockets

Notice the -r option is still documented.  Seen in 1.15.3 and 1.17.1,
this patch is a fix for 1.17.1

Signed-off-by: Bob Dunlop <bob.dunlop at xyzzy.org.uk>


--- busybox-1.17.1/include/usage.src.h-orig	2010-10-26 10:26:43.000000000 +0100
+++ busybox-1.17.1/include/usage.src.h	2010-10-26 10:27:52.000000000 +0100
@@ -2962,7 +2962,7 @@
        "$ nameif -c /etc/my_mactab_file\n" \
 
 #define netstat_trivial_usage \
-       "[-laentuwxr"IF_FEATURE_NETSTAT_WIDE("W")IF_FEATURE_NETSTAT_PRG("p")"]"
+       "[-laentuwx"IF_ROUTE("r")IF_FEATURE_NETSTAT_WIDE("W")IF_FEATURE_NETSTAT_PRG("p")"]"
 #define netstat_full_usage "\n\n" \
        "Display networking information\n" \
      "\nOptions:" \
@@ -2974,7 +2974,9 @@
      "\n	-u	Udp sockets" \
      "\n	-w	Raw sockets" \
      "\n	-x	Unix sockets" \
+	IF_ROUTE( \
      "\n	-r	Display routing table" \
+	) \
 	IF_FEATURE_NETSTAT_WIDE( \
      "\n	-W	Display with no column truncation" \
 	) \


-- 
        Bob Dunlop


More information about the busybox mailing list