Changeset 3621 in MondoRescue for branches/3.3/mindi-busybox/networking/netstat.c
- Timestamp:
- Dec 20, 2016, 4:07:32 PM (7 years ago)
- Location:
- branches/3.3
- Files:
-
- 1 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3/mindi-busybox/networking/netstat.c
r3232 r3621 120 120 /* When there are IPv6 connections the IPv6 addresses will be 121 121 * truncated to none-recognition. The '-W' option makes the 122 * address columns wide enough to accom odate for longest possible122 * address columns wide enough to accommodate for longest possible 123 123 * IPv6 addresses, i.e. addresses of the form 124 124 * xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:ddd.ddd.ddd.ddd … … 126 126 #define ADDR_WIDE 51 /* INET6_ADDRSTRLEN + 5 for the port number */ 127 127 #if ENABLE_FEATURE_NETSTAT_WIDE 128 # define FMT_NET_CONN_DATA "%s %6l d %6ld%-*s %-*s %-12s"128 # define FMT_NET_CONN_DATA "%s %6lu %6lu %-*s %-*s %-12s" 129 129 # define FMT_NET_CONN_HEADER "\nProto Recv-Q Send-Q %-*s %-*s State %s\n" 130 130 #else 131 # define FMT_NET_CONN_DATA "%s %6l d %6ld%-23s %-23s %-12s"131 # define FMT_NET_CONN_DATA "%s %6lu %6lu %-23s %-23s %-12s" 132 132 # define FMT_NET_CONN_HEADER "\nProto Recv-Q Send-Q %-23s %-23s State %s\n" 133 133 #endif … … 229 229 long inode = -1; 230 230 231 if ( strncmp(lname, "socket:[", sizeof("socket:[")-1) == 0) {231 if (is_prefixed_with(lname, "socket:[")) { 232 232 /* "socket:[12345]", extract the "12345" as inode */ 233 233 inode = bb_strtoul(lname + sizeof("socket:[")-1, (char**)&lname, 0); 234 234 if (*lname != ']') 235 235 inode = -1; 236 } else if ( strncmp(lname, "[0000]:", sizeof("[0000]:")-1) == 0) {236 } else if (is_prefixed_with(lname, "[0000]:")) { 237 237 /* "[0000]:12345", extract the "12345" as inode */ 238 238 inode = bb_strtoul(lname + sizeof("[0000]:")-1, NULL, 0); … … 404 404 "%32[0-9A-Fa-f]:%X %X " 405 405 "%lX:%lX %*X:%*X " 406 "%*X %d %*d %l d",406 "%*X %d %*d %lu ", 407 407 local_addr, ¶m->local_port, 408 408 rem_addr, ¶m->rem_port, ¶m->state, … … 612 612 strcat(ss_flags, "]"); 613 613 614 printf("%-5s %-6l d%-11s %-10s %-13s %6lu ",614 printf("%-5s %-6lu %-11s %-10s %-13s %6lu ", 615 615 ss_proto, refcnt, ss_flags, ss_type, ss_state, inode 616 616 ); … … 623 623 /* TODO: currently we stop at first NUL byte. Is it a problem? */ 624 624 line += path_ofs; 625 *strchrnul(line, '\n') = '\0';625 chomp(line); 626 626 while (*line) 627 627 fputc_printable(*line++, stdout);
Note:
See TracChangeset
for help on using the changeset viewer.