getopt: FEATURE_GETOPT_LONG for -l; rename GETOPT_LONG to LONG_OPTS

Signed-off-by: Colin Watson <cjwatson@ubuntu.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko
2009-06-19 12:10:38 +02:00
parent e2e4cc249d
commit f3b92d3856
26 changed files with 82 additions and 74 deletions

View File

@@ -204,7 +204,7 @@ config ENV
config FEATURE_ENV_LONG_OPTIONS
bool "Enable long options"
default n
depends on ENV && GETOPT_LONG
depends on ENV && LONG_OPTS
help
Support long options for the env applet.
@@ -217,7 +217,7 @@ config EXPAND
config FEATURE_EXPAND_LONG_OPTIONS
bool "Enable long options"
default n
depends on EXPAND && GETOPT_LONG
depends on EXPAND && LONG_OPTS
help
Support long options for the expand applet.
@@ -291,7 +291,7 @@ config INSTALL
config FEATURE_INSTALL_LONG_OPTIONS
bool "Enable long options"
default n
depends on INSTALL && GETOPT_LONG
depends on INSTALL && LONG_OPTS
help
Support long options for the install applet.
@@ -364,7 +364,7 @@ config FEATURE_LS_USERNAME
config FEATURE_LS_COLOR
bool "Allow use of color to identify file types"
default y
depends on LS && GETOPT_LONG
depends on LS && LONG_OPTS
help
This enables the --color option to ls.
@@ -394,7 +394,7 @@ config MKDIR
config FEATURE_MKDIR_LONG_OPTIONS
bool "Enable long options"
default n
depends on MKDIR && GETOPT_LONG
depends on MKDIR && LONG_OPTS
help
Support long options for the mkdir applet.
@@ -421,7 +421,7 @@ config MV
config FEATURE_MV_LONG_OPTIONS
bool "Enable long options"
default n
depends on MV && GETOPT_LONG
depends on MV && LONG_OPTS
help
Support long options for the mv applet.
@@ -498,7 +498,7 @@ config RMDIR
config FEATURE_RMDIR_LONG_OPTIONS
bool "Enable long options"
default n
depends on RMDIR && GETOPT_LONG
depends on RMDIR && LONG_OPTS
help
Support long options for the rmdir applet, including
--ignore-fail-on-non-empty for compatibility with GNU rmdir.
@@ -732,7 +732,7 @@ config UNEXPAND
config FEATURE_UNEXPAND_LONG_OPTIONS
bool "Enable long options"
default n
depends on UNEXPAND && GETOPT_LONG
depends on UNEXPAND && LONG_OPTS
help
Support long options for the unexpand applet.

View File

@@ -832,7 +832,7 @@ format_address_std(off_t address, char c)
printf(address_fmt, address);
}
#if ENABLE_GETOPT_LONG
#if ENABLE_LONG_OPTS
/* only used with --traditional */
static void
format_address_paren(off_t address, char c)
@@ -953,7 +953,7 @@ get_lcm(void)
return l_c_m;
}
#if ENABLE_GETOPT_LONG
#if ENABLE_LONG_OPTS
/* If S is a valid traditional offset specification with an optional
leading '+' return nonzero and set *OFFSET to the offset it denotes. */
@@ -1199,9 +1199,9 @@ int od_main(int argc, char **argv)
OPT_s = 1 << 15,
OPT_S = 1 << 16,
OPT_w = 1 << 17,
OPT_traditional = (1 << 18) * ENABLE_GETOPT_LONG,
OPT_traditional = (1 << 18) * ENABLE_LONG_OPTS,
};
#if ENABLE_GETOPT_LONG
#if ENABLE_LONG_OPTS
static const char od_longopts[] ALIGN1 =
"skip-bytes\0" Required_argument "j"
"address-radix\0" Required_argument "A"
@@ -1235,7 +1235,7 @@ int od_main(int argc, char **argv)
/* Parse command line */
opt_complementary = "w+:t::"; /* -w N, -t is a list */
#if ENABLE_GETOPT_LONG
#if ENABLE_LONG_OPTS
applet_long_options = od_longopts;
#endif
opt = getopt32(argv, "A:N:abcdfhij:lot:vxsS:"
@@ -1306,7 +1306,7 @@ int od_main(int argc, char **argv)
* FIXME: POSIX 1003.1-2001 with XSI requires support for the
* traditional syntax even if --traditional is not given. */
#if ENABLE_GETOPT_LONG
#if ENABLE_LONG_OPTS
if (opt & OPT_traditional) {
off_t o1, o2;

View File

@@ -41,7 +41,7 @@ int touch_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int touch_main(int argc UNUSED_PARAM, char **argv)
{
#if ENABLE_DESKTOP
#if ENABLE_GETOPT_LONG
#if ENABLE_LONG_OPTS
static const char longopts[] ALIGN1 =
/* name, has_arg, val */
"no-create\0" No_argument "c"
@@ -59,7 +59,7 @@ int touch_main(int argc UNUSED_PARAM, char **argv)
int opts;
#if ENABLE_DESKTOP
#if ENABLE_GETOPT_LONG
#if ENABLE_LONG_OPTS
applet_long_options = longopts;
#endif
#endif

View File

@@ -73,7 +73,7 @@ static const unsigned short utsname_offset[] = {
int uname_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int uname_main(int argc UNUSED_PARAM, char **argv)
{
#if ENABLE_GETOPT_LONG
#if ENABLE_LONG_OPTS
static const char longopts[] ALIGN1 =
/* name, has_arg, val */
"all\0" No_argument "a"
@@ -97,7 +97,7 @@ int uname_main(int argc UNUSED_PARAM, char **argv)
const unsigned short *delta;
unsigned toprint;
IF_GETOPT_LONG(applet_long_options = longopts);
IF_LONG_OPTS(applet_long_options = longopts);
toprint = getopt32(argv, options);
if (argv[optind]) { /* coreutils-6.9 compat */