grep: add proper support for pattern_list
[oweals/busybox.git] / networking / netstat.c
index 68e0c1a040c53ff8b3f1efe6359d48847a5c1ae2..c7934423ba0da9b08db41d338375b1e519e86929 100644 (file)
  * Licensed under GPLv2 or later, see file LICENSE in this source tree.
  */
 //config:config NETSTAT
-//config:      bool "netstat"
+//config:      bool "netstat (10 kb)"
 //config:      default y
 //config:      select PLATFORM_LINUX
 //config:      help
-//config:        netstat prints information about the Linux networking subsystem.
+//config:      netstat prints information about the Linux networking subsystem.
 //config:
 //config:config FEATURE_NETSTAT_WIDE
 //config:      bool "Enable wide output"
 //config:      default y
 //config:      depends on NETSTAT
 //config:      help
-//config:        Add support for wide columns. Useful when displaying IPv6 addresses
-//config:        (-W option).
+//config:      Add support for wide columns. Useful when displaying IPv6 addresses
+//config:      (-W option).
 //config:
 //config:config FEATURE_NETSTAT_PRG
 //config:      bool "Enable PID/Program name output"
 //config:      default y
 //config:      depends on NETSTAT
 //config:      help
-//config:        Add support for -p flag to print out PID and program name.
-//config:        +700 bytes of code.
+//config:      Add support for -p flag to print out PID and program name.
+//config:      +700 bytes of code.
 
 //applet:IF_NETSTAT(APPLET(netstat, BB_DIR_BIN, BB_SUID_DROP))
 
@@ -172,7 +172,7 @@ struct prg_node {
 #define PRG_HASH_SIZE 211
 
 struct globals {
-       smallint flags;
+       smalluint flags;
 #if ENABLE_FEATURE_NETSTAT_PRG
        smallint prg_cache_loaded;
        struct prg_node *prg_hash[PRG_HASH_SIZE];
@@ -343,9 +343,9 @@ static void prg_cache_load(void)
                return;
 
        if (prg_cache_loaded == 1)
-               bb_error_msg("can't scan /proc - are you root?");
+               bb_simple_error_msg("can't scan /proc - are you root?");
        else
-               bb_error_msg("showing only processes with your user ID");
+               bb_simple_error_msg("showing only processes with your user ID");
 }
 
 #else
@@ -397,8 +397,11 @@ static char *ip_port_str(struct sockaddr *addr, int port, const char *proto, int
        /* Code which used "*" for INADDR_ANY is removed: it's ambiguous
         * in IPv6, while "0.0.0.0" is not. */
 
-       host = numeric ? xmalloc_sockaddr2dotted_noport(addr)
-                      : xmalloc_sockaddr2host_noport(addr);
+       host = NULL;
+       if (!numeric)
+               host = xmalloc_sockaddr2host_noport(addr);
+       if (!host)
+               host = xmalloc_sockaddr2dotted_noport(addr);
 
        host_port = xasprintf("%s:%s", host, get_sname(htons(port), proto, numeric));
        free(host);