[BusyBox] uname patch and questions

Glenn McGrath bug1 at optushome.com.au
Mon Nov 26 20:10:26 UTC 2001


On Mon, 26 Nov 2001 11:21:19 -0700
"Manuel Novoa III" <mjn3 at busybox.net> wrote:

> Glenn,
> 
> At some cost in readability, you can save more space by:
> 1) Getting rid of the switch statement in arg processing.

Thats a pretty good trick

> 2) Getting rid of the print_element function and its associated
redundancy.
> 
Wow, i had never even heard of offsetof, i was trying to think of a way
of doing the same thing.

> Also, I'm assuming you didn't mean to declare 'name' as static.  ;-)
it seemed like a good idea at the time, dont know why :)

> Since it isn't that large, I've attached a modified version which for
me
> saves about another 150 bytes.  It should behave as your version did
except
> that it treats option p as a synonym for option m.
> 

Looks very good, i should follow your code more often, i might learn
some new tricks.

The only thing i would change would be to declare utsname_offset[],
options[] and flags[] inside uname_main() as that the only place they
are used. Is there a reason not to, or is it just aesthetics ?


Glenn






More information about the busybox mailing list