Query: the getopt applet

Denis Vlasenko vda.linux at googlemail.com
Fri Mar 30 21:32:48 UTC 2007


On Friday 30 March 2007 13:05, Mats Erik Andersson wrote:
> I am investigating the possibility of converting the 
> getopt applet to use the getopt32 funcionality. At present
> I have converted that part of option parsing which the
> applet needs for its own work and decisions.  That leads
> to far to a decrease by 75 bytes only. Not much!

We appreciate small code size reductions too.

> However, I am wondering about the "alternate functionality"
> that allows the flag '-boo' to replace '--boo'. Is it worth the
> effort of producing an applet that ignores this feature, but
> uses getopt32 throughout?

After looking thru getopt.c, I am not sure whether
if it wise to try to convert it to getopt32.

I don't see how is it possible to use only getopt32()
and not lose information about option order.
I am referring to getopt_long[_only] calls
in generate_output(). getopt32() will automatically
sort the options. This changes the API.

> Is there a demand for an applet 
> that completely ignores long options, but hopefully internally
> works by using getopt-susv3 only?

You may introduce CONFIG_FEATURE_GETOPT_LONG option and
make it so that if it is off,
getopt (applet) doesnt recognize longopts.
--
vda



More information about the busybox mailing list