RFC: cleaning up naming mess
Rob Landley
rob at landley.net
Tue Oct 3 18:38:29 UTC 2006
On Monday 02 October 2006 5:52 pm, Denis Vlasenko wrote:
> General guidelines:
Looks good to me. A few comments from the peanut gallery:
> bb_xfunc is sort of stupid. Either bb_ or x, not both.
>
> xfunc() should closely match libc func() (in params and return value).
> Otherwise use name like func_or_die()
Edge cases are things like xferror(), which take an extra parameter which is
the message to print when dying. I could see yanking that parameter and
having the message just be "xferror" though. Especially if it's a perror,
although I dunno if ferror() sets errno.
> bb_getopt_ulflags
>
> Rename to getopt32. Because abi _has to_ have exact number of bits.
When I added a stub for that in toybox a couple days back I wound up calling
it get_optflags(). (My version won't actually use getopt(), and my general
theory is if you have more than 32 flags, something is wrong with the design
of your applet. :)
> Just think about applet with 33 different options.
Such as hdparm?
Might want to define it to return uint32_t if you're enforcing this?
> bb_fflush_stdout_and_exit
My todo list had "add xfclose()", because (sadly) nfs cares and due to its
funky buffering can return an error (like "disk full") when you _close_ the
file. Note you need not just an fflush() but an fsync() before the return
value of fclose() becomes useful, so actually doing this should probably be a
config option.
Rob
--
Never bet against the cheap plastic solution.
More information about the busybox
mailing list