[BusyBox] uname patch and questions
Manuel Novoa III
mjn3 at busybox.net
Mon Nov 26 11:21:19 UTC 2001
Glenn,
On Tue, Nov 27, 2001 at 01:18:27AM +1100, Glenn McGrath wrote:
> This patch saves about 200 Bytes, minor changes are
> - uses getopt
> - use enum instead of 6 static ints (using #define probably would save
> a fraction more)
> - use char instead of unsigned int
> - parse variable through function isntead using static global variable
>
> and the questionable changes,
> - print an extra space prior to newline (avoid having to working if
> its the last item)
> - dont attempt to display processor type (-p option), it always
> printed "unknown" anyway becasue HAVE_SYSINFO and SI_ARCHITECTURE are
> never defined (as far as i can see), and i dont see how -m and -p would
> be different as -m prints my processor type "i686", i assume it does
> similar on other arch's.
>
> I'll commit it if i get the ok, but wasnt sure about the last two items.
At some cost in readability, you can save more space by:
1) Getting rid of the switch statement in arg processing.
2) Getting rid of the print_element function and its associated redundancy.
Also, I'm assuming you didn't mean to declare 'name' as static. ;-)
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.
text data bss dec hex filename
576 0 1 577 241 uname-dist.o
387 0 390 777 309 uname-glen.o
238 0 0 238 ee uname.o
Manuel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: uname.c
Type: text/x-csrc
Size: 2632 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20011126/13d5bf23/attachment.c
More information about the busybox
mailing list