find: support -HLP
[oweals/busybox.git] / networking / netstat.c
index 485a7d1919f1dda862d069d7e40079919ff019e0..c0c6ba5010ddc567ac3be49516ab3445d9436eb1 100644 (file)
@@ -21,7 +21,6 @@
 //usage:       "[-"IF_ROUTE("r")"al] [-tuwx] [-en"IF_FEATURE_NETSTAT_WIDE("W")IF_FEATURE_NETSTAT_PRG("p")"]"
 //usage:#define netstat_full_usage "\n\n"
 //usage:       "Display networking information\n"
-//usage:     "\nOptions:"
 //usage:       IF_ROUTE(
 //usage:     "\n       -r      Routing table"
 //usage:       )
@@ -188,7 +187,7 @@ static void prg_cache_add(long inode, char *name)
        for (pnp = prg_hash + hi; (pn = *pnp) != NULL; pnp = &pn->next) {
                if (pn->inode == inode) {
                        /* Some warning should be appropriate here
-                          as we got multiple processes for one i-node */
+                        * as we got multiple processes for one i-node */
                        return;
                }
        }
@@ -395,11 +394,14 @@ struct inet_params {
 static int scan_inet_proc_line(struct inet_params *param, char *line)
 {
        int num;
-       char local_addr[64], rem_addr[64];
+       /* IPv6 /proc files use 32-char hex representation
+        * of IPv6 address, followed by :PORT_IN_HEX
+        */
+       char local_addr[33], rem_addr[33]; /* 32 + 1 for NUL */
 
        num = sscanf(line,
-                       "%*d: %64[0-9A-Fa-f]:%X "
-                       "%64[0-9A-Fa-f]:%X %X "
+                       "%*d: %32[0-9A-Fa-f]:%X "
+                       "%32[0-9A-Fa-f]:%X %X "
                        "%lX:%lX %*X:%*X "
                        "%*X %d %*d %ld ",
                        local_addr, &param->local_port,
@@ -696,7 +698,7 @@ int netstat_main(int argc UNUSED_PARAM, char **argv)
                flags |= opt;
        }
        if (flags & (NETSTAT_TCP|NETSTAT_UDP|NETSTAT_RAW)) {
-               printf("Active Internet connections "); /* xxx */
+               printf("Active Internet connections "); /* xxx */
 
                if ((flags & (NETSTAT_LISTENING|NETSTAT_CONNECTED)) == (NETSTAT_LISTENING|NETSTAT_CONNECTED))
                        printf("(servers and established)");