[patch] netstat -W (wide) option

Cristian Ionescu-Idbohrn cristian.ionescu-idbohrn at axis.com
Wed May 16 09:21:15 UTC 2007


On Wed, 16 May 2007, Denis Vlasenko wrote:

> Thanks! Applying, with attached patch on top
> (further shringk by ~180 bytes + fix for bogus state
> value for raw sockets)

Thank you!
Unfortunatelly, a small bug crept in :(

At this point in the code 'opt' has one value:

    532         if (opt & OPT_widedisplay) { // -W

but 'opt' is modified on the way, and by the time it reaches this
point:

    550                 printf((opt & OPT_widedisplay) ? PRINT_NET_CONN_HEADER_WIDE : PRINT_NET_CONN_HEADER,

'opt' has another value; '(opt & OPT_widedisplay)' evaluates to 0 and
a short line (instead of a wide) is printed.

The attatched patch solves the problem, but it also adds 15 bytes :(

function                                             old     new   delta
netstat_main                                         484     495     +11
net_conn_line_header                                   -       4      +4
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/0 up/down: 15/0)               Total: 15 bytes

But, as they say: TMTOWTDI :)


Cheers,
Cristian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: busybox-netstat-svn-accepted-fix.diff
Type: text/x-diff
Size: 1068 bytes
Desc: 
Url : http://lists.busybox.net/pipermail/busybox/attachments/20070516/f62fa20d/attachment-0002.bin 


More information about the busybox mailing list