weird code snippet in cpio.c

Robert P. J. Day rpjday at crashcourse.ca
Wed Jul 16 20:58:17 UTC 2008


On Wed, 16 Jul 2008, Denys Vlasenko wrote:

> On Wednesday 16 July 2008 20:37, Robert P. J. Day wrote:
> >
> >   from archival/cpio.c:
> >
> > ...
> > #if ENABLE_GETOPT_LONG && ENABLE_DESKTOP
> >     applet_long_options =
> >         "extract\0"      No_argument       "i"
> >         "list\0"         No_argument       "t"
> > #if ENABLE_FEATURE_CPIO_O
> >         "create\0"       No_argument       "o"
> >         "format\0"       Required_argument "H"
> > #endif
> >         ;
> > #endif
> > ...
> >
> >   why does defining those long options require the definition of
> > ENABLE_DESKTOP?  the "i" and "t" options will be defined regardless,
> > so shouldn't that snippet depend solely on ENABLE_GETOPT_LONG?
>
> I was lazy to add yet another option ENABLE_CPIO_GETOPT_LONG, as
> many other applets do.

i don't see *any* other applet that adds that kind of applet-specific
option, but that's not the point i was making.

if you select the cpio applet, then you'll get cpio and you'll get the
basic "i" and "t" options supported.  however, if you also select
GETOPT_LONG, you would normally assume that you would then get the
additional long forms of those options.  but you don't unless you've
additionally enabled ENABLE_DESKTOP.  in my mind, that's simply wrong.

if i specifically select ENABLE_GETOPT_LONG, then i should get long
options.  that shouldn't depend on my selection of yet another magic
configuration variable.

> Sometimes other people submit patches which add such options.
> I presume they need more finegrained control.
> IOW: xxx_GETOPT_LONG options are added on as-needed basis.

that has nothing to do with what i'm describing above.

rday
--

========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry:
    Have classroom, will lecture.

http://crashcourse.ca                          Waterloo, Ontario, CANADA
========================================================================



More information about the busybox mailing list