[Toybox] hostname implementation

Rob Landley rob at landley.net
Wed Feb 15 04:03:14 PST 2012


On 02/12/2012 02:23 PM, Andre Renaud wrote:
> Hi,
> Here is a pretty minimal implementation of the 'hostname' command.

Very nice.  Committed.

Minor cleanups: I switched buf to toybuf, and moved a strlen call inline
(since it was only used once).

I also replaced the "" option string with NULL, because that lets the
build infrastructure know it can skip the option parsing logic entirely.
 (I.E. if you build just commands with NULL option strings, the option
parsing logic can drop out via dead code elimination.  that's what the
NEED_OPTIONS magic in main.c accomplishes, it comes up with a 0 or 1
constant the if () statements can use to remove calls to the option
parsing logic.)

This is likely to be most useful when I get around to writing an
alternate main.c that lets you efficiently build individual commands
(I.E. a standalone hostname binary). No huge advantage in it, but people
keep wanting to do it, and I taught busybox to do it, so might as well...

Rob



More information about the Toybox mailing list