weird code snippet in cpio.c
Denys Vlasenko
vda.linux at googlemail.com
Wed Jul 16 21:53:40 UTC 2008
On Wednesday 16 July 2008 22:58, Robert P. J. Day wrote:
> 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.
# grep LONG .config
CONFIG_GETOPT_LONG=y
CONFIG_FEATURE_AR_LONG_FILENAMES=y
CONFIG_FEATURE_TAR_LONG_OPTIONS=y
CONFIG_FEATURE_ENV_LONG_OPTIONS=y
CONFIG_FEATURE_EXPAND_LONG_OPTIONS=y
CONFIG_FEATURE_INSTALL_LONG_OPTIONS=y
CONFIG_FEATURE_MKDIR_LONG_OPTIONS=y
CONFIG_FEATURE_MV_LONG_OPTIONS=y
CONFIG_FEATURE_RMDIR_LONG_OPTIONS=y
CONFIG_FEATURE_UNEXPAND_LONG_OPTIONS=y
CONFIG_FEATURE_SETCONSOLE_LONG_OPTIONS=y
CONFIG_FEATURE_RUN_PARTS_LONG_OPTIONS=y
CONFIG_FEATURE_START_STOP_DAEMON_LONG_OPTIONS=y
CONFIG_FEATURE_ADDUSER_LONG_OPTIONS=y
CONFIG_FEATURE_HWCLOCK_LONG_OPTIONS=y
CONFIG_FEATURE_FTPGETPUT_LONG_OPTIONS=y
CONFIG_FEATURE_IPCALC_LONG_OPTIONS=y
CONFIG_FEATURE_WGET_LONG_OPTIONS=y
CONFIG_FEATURE_CHCON_LONG_OPTIONS=y
CONFIG_FEATURE_RUNCON_LONG_OPTIONS=y
> 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.
I removed " && ENABLE_DESKTOP" in cpio.c now.
--
vda
More information about the busybox
mailing list