[BusyBox] calling getopt() centrally
Vladimir N. Oleynik
dzo at simtreas.ru
Thu Dec 19 02:18:04 UTC 2002
Russ,
> > My idea:
> > All applet use small count options. 'ls' applet have many
> > options, but original GNU 'ls' use ~45 options.
> > So... We can using 64 bit flags.
> > For each applet making macros:
> > example mkdir getopt(m:p")
> >
> >
> > applets.h:
> >
> > const char **applet_opts; /* opts args */
> > long long opts_setted; /* 64 bits flags */
> >
>
> I would steer away from using a long long, you could use two longs, one
> for [a-z] and the other for [A-Z].
Current busybox 'ls' applet have 27 options.
We can use only 32 bites flag so far for long time ;)
> Alternatively, you could set 52
> globals, opt_[a-z], opt_[A-Z]
Brrr. Original Bob`s idea better.
I long time thinking other algorithm.
We can create busybox_getopt() function. This function can haven`t arguments,
since argc, argv we can set from busybox_main and getopt_string from
applets_struct.
Also, we can removing show_usage() from each applet.
This require minimal changes, don`t added code for double parse options from
previous ideas.
--w
vodz
More information about the busybox
mailing list