diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2006-05-26 20:19:22 +0000 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2006-05-26 20:19:22 +0000 |
commit | 01d23ade577b94a1ab1fde54f69a3ce5f7399f3c (patch) | |
tree | 4071ca983cbd5a3912501bd1467dc063b3592aa9 /coreutils | |
parent | d29337580e6ad49ca3353a22b9099e9e47a4bd17 (diff) |
- add central knob to turn off getopt_long everywhere. EXPERIMENTAL!
Adds "Enable getopt long" under "General options", default y.
Send patches to fix getopt_ulflags and run_parts.c if you turn this off..
See http://busybox.net/lists/busybox/2006-May/021828.html for a start to run-parts
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/Config.in | 30 | ||||
-rw-r--r-- | coreutils/env.c | 5 | ||||
-rw-r--r-- | coreutils/install.c | 4 | ||||
-rw-r--r-- | coreutils/mkdir.c | 4 | ||||
-rw-r--r-- | coreutils/mv.c | 4 |
5 files changed, 45 insertions, 2 deletions
diff --git a/coreutils/Config.in b/coreutils/Config.in index d7e31e868..818854cb1 100644 --- a/coreutils/Config.in +++ b/coreutils/Config.in @@ -232,6 +232,13 @@ config CONFIG_ENV a command; without options it displays the current environment. +config CONFIG_FEATURE_ENV_LONG_OPTIONS + bool "Enable long options" + default n + depends on CONFIG_ENV && CONFIG_GETOPT_LONG + help + Support long options for the env applet. + config CONFIG_EXPR bool "expr" default n @@ -293,6 +300,13 @@ config CONFIG_INSTALL help Copy files and set attributes. +config CONFIG_FEATURE_INSTALL_LONG_OPTIONS + bool "Enable long options" + default n + depends on CONFIG_INSTALL && CONFIG_GETOPT_LONG + help + Support long options for the install applet. + config CONFIG_LENGTH bool "length" default n @@ -362,7 +376,7 @@ config CONFIG_FEATURE_LS_USERNAME config CONFIG_FEATURE_LS_COLOR bool "Allow use of color to identify file types" default y - depends on CONFIG_LS + depends on CONFIG_LS && CONFIG_GETOPT_LONG help This enables the --color option to ls. @@ -389,6 +403,13 @@ config CONFIG_MKDIR help mkdir is used to create directories with the specified names. +config CONFIG_FEATURE_MKDIR_LONG_OPTIONS + bool "Enable long options" + default n + depends on CONFIG_MKDIR && CONFIG_GETOPT_LONG + help + Support long options for the mkdir applet. + config CONFIG_MKFIFO bool "mkfifo" default n @@ -409,6 +430,13 @@ config CONFIG_MV help mv is used to move or rename files or directories. +config CONFIG_FEATURE_MV_LONG_OPTIONS + bool "Enable long options" + default n + depends on CONFIG_MV && CONFIG_GETOPT_LONG + help + Support long options for the mv applet. + config CONFIG_NICE bool "nice" default n diff --git a/coreutils/env.c b/coreutils/env.c index fd58a23da..a07c0c617 100644 --- a/coreutils/env.c +++ b/coreutils/env.c @@ -50,12 +50,13 @@ #include <getopt.h> /* struct option */ #include "busybox.h" - +#if ENABLE_FEATURE_ENV_LONG_OPTIONS static const struct option env_long_options[] = { { "ignore-environment", 0, NULL, 'i' }, { "unset", 1, NULL, 'u' }, { 0, 0, 0, 0 } }; +#endif int env_main(int argc, char** argv) { @@ -67,7 +68,9 @@ int env_main(int argc, char** argv) extern char **environ; bb_opt_complementally = "u::"; +#if ENABLE_FEATURE_ENV_LONG_OPTIONS bb_applet_long_options = env_long_options; +#endif opt = bb_getopt_ulflags(argc, argv, "+iu:", &unset_env); diff --git a/coreutils/install.c b/coreutils/install.c index 7739fb615..90b3ef31b 100644 --- a/coreutils/install.c +++ b/coreutils/install.c @@ -39,6 +39,7 @@ #define INSTALL_OPT_MODE 32 #define INSTALL_OPT_OWNER 64 +#if ENABLE_FEATURE_INSTALL_LONG_OPTIONS static const struct option install_long_options[] = { { "directory", 0, NULL, 'd' }, { "preserve-timestamps", 0, NULL, 'p' }, @@ -48,6 +49,7 @@ static const struct option install_long_options[] = { { "owner", 0, NULL, 'o' }, { 0, 0, 0, 0 } }; +#endif int install_main(int argc, char **argv) { @@ -60,7 +62,9 @@ int install_main(int argc, char **argv) int copy_flags = FILEUTILS_DEREFERENCE | FILEUTILS_FORCE; int ret = EXIT_SUCCESS, flags, i, isdir; +#if ENABLE_FEATURE_INSTALL_LONG_OPTIONS bb_applet_long_options = install_long_options; +#endif bb_opt_complementally = "?:s--d:d--s"; /* -c exists for backwards compatibility, its needed */ flags = bb_getopt_ulflags(argc, argv, "cdpsg:m:o:", &gid_str, &mode_str, &uid_str); /* 'a' must be 2nd */ diff --git a/coreutils/mkdir.c b/coreutils/mkdir.c index 48a95badb..47f4cc843 100644 --- a/coreutils/mkdir.c +++ b/coreutils/mkdir.c @@ -34,11 +34,13 @@ #include <getopt.h> /* struct option */ #include "busybox.h" +#if ENABLE_FEATURE_MKDIR_LONG_OPTIONS static const struct option mkdir_long_options[] = { { "mode", 1, NULL, 'm' }, { "parents", 0, NULL, 'p' }, { 0, 0, 0, 0 } }; +#endif int mkdir_main (int argc, char **argv) { @@ -48,7 +50,9 @@ int mkdir_main (int argc, char **argv) unsigned long opt; char *smode; +#if ENABLE_FEATURE_MKDIR_LONG_OPTIONS bb_applet_long_options = mkdir_long_options; +#endif opt = bb_getopt_ulflags(argc, argv, "m:p", &smode); if(opt & 1) { mode = 0777; diff --git a/coreutils/mv.c b/coreutils/mv.c index 1c0dc3d72..02252c7ef 100644 --- a/coreutils/mv.c +++ b/coreutils/mv.c @@ -35,11 +35,13 @@ #include "busybox.h" #include "libcoreutils/coreutils.h" +#if ENABLE_FEATURE_MV_LONG_OPTIONS static const struct option mv_long_options[] = { { "interactive", 0, NULL, 'i' }, { "force", 0, NULL, 'f' }, { 0, 0, 0, 0 } }; +#endif #define OPT_FILEUTILS_FORCE 1 #define OPT_FILEUTILS_INTERACTIVE 2 @@ -55,7 +57,9 @@ int mv_main(int argc, char **argv) int dest_exists; int status = 0; +#if ENABLE_FEATURE_MV_LONG_OPTIONS bb_applet_long_options = mv_long_options; +#endif bb_opt_complementally = "f-i:i-f"; flags = bb_getopt_ulflags(argc, argv, "fi"); if (optind + 2 > argc) { |