diff options
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 | |||
232 | a command; without options it displays the current | 232 | a command; without options it displays the current |
233 | environment. | 233 | environment. |
234 | 234 | ||
235 | config CONFIG_FEATURE_ENV_LONG_OPTIONS | ||
236 | bool "Enable long options" | ||
237 | default n | ||
238 | depends on CONFIG_ENV && CONFIG_GETOPT_LONG | ||
239 | help | ||
240 | Support long options for the env applet. | ||
241 | |||
235 | config CONFIG_EXPR | 242 | config CONFIG_EXPR |
236 | bool "expr" | 243 | bool "expr" |
237 | default n | 244 | default n |
@@ -293,6 +300,13 @@ config CONFIG_INSTALL | |||
293 | help | 300 | help |
294 | Copy files and set attributes. | 301 | Copy files and set attributes. |
295 | 302 | ||
303 | config CONFIG_FEATURE_INSTALL_LONG_OPTIONS | ||
304 | bool "Enable long options" | ||
305 | default n | ||
306 | depends on CONFIG_INSTALL && CONFIG_GETOPT_LONG | ||
307 | help | ||
308 | Support long options for the install applet. | ||
309 | |||
296 | config CONFIG_LENGTH | 310 | config CONFIG_LENGTH |
297 | bool "length" | 311 | bool "length" |
298 | default n | 312 | default n |
@@ -362,7 +376,7 @@ config CONFIG_FEATURE_LS_USERNAME | |||
362 | config CONFIG_FEATURE_LS_COLOR | 376 | config CONFIG_FEATURE_LS_COLOR |
363 | bool "Allow use of color to identify file types" | 377 | bool "Allow use of color to identify file types" |
364 | default y | 378 | default y |
365 | depends on CONFIG_LS | 379 | depends on CONFIG_LS && CONFIG_GETOPT_LONG |
366 | help | 380 | help |
367 | This enables the --color option to ls. | 381 | This enables the --color option to ls. |
368 | 382 | ||
@@ -389,6 +403,13 @@ config CONFIG_MKDIR | |||
389 | help | 403 | help |
390 | mkdir is used to create directories with the specified names. | 404 | mkdir is used to create directories with the specified names. |
391 | 405 | ||
406 | config CONFIG_FEATURE_MKDIR_LONG_OPTIONS | ||
407 | bool "Enable long options" | ||
408 | default n | ||
409 | depends on CONFIG_MKDIR && CONFIG_GETOPT_LONG | ||
410 | help | ||
411 | Support long options for the mkdir applet. | ||
412 | |||
392 | config CONFIG_MKFIFO | 413 | config CONFIG_MKFIFO |
393 | bool "mkfifo" | 414 | bool "mkfifo" |
394 | default n | 415 | default n |
@@ -409,6 +430,13 @@ config CONFIG_MV | |||
409 | help | 430 | help |
410 | mv is used to move or rename files or directories. | 431 | mv is used to move or rename files or directories. |
411 | 432 | ||
433 | config CONFIG_FEATURE_MV_LONG_OPTIONS | ||
434 | bool "Enable long options" | ||
435 | default n | ||
436 | depends on CONFIG_MV && CONFIG_GETOPT_LONG | ||
437 | help | ||
438 | Support long options for the mv applet. | ||
439 | |||
412 | config CONFIG_NICE | 440 | config CONFIG_NICE |
413 | bool "nice" | 441 | bool "nice" |
414 | default n | 442 | 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 @@ | |||
50 | #include <getopt.h> /* struct option */ | 50 | #include <getopt.h> /* struct option */ |
51 | #include "busybox.h" | 51 | #include "busybox.h" |
52 | 52 | ||
53 | 53 | #if ENABLE_FEATURE_ENV_LONG_OPTIONS | |
54 | static const struct option env_long_options[] = { | 54 | static const struct option env_long_options[] = { |
55 | { "ignore-environment", 0, NULL, 'i' }, | 55 | { "ignore-environment", 0, NULL, 'i' }, |
56 | { "unset", 1, NULL, 'u' }, | 56 | { "unset", 1, NULL, 'u' }, |
57 | { 0, 0, 0, 0 } | 57 | { 0, 0, 0, 0 } |
58 | }; | 58 | }; |
59 | #endif | ||
59 | 60 | ||
60 | int env_main(int argc, char** argv) | 61 | int env_main(int argc, char** argv) |
61 | { | 62 | { |
@@ -67,7 +68,9 @@ int env_main(int argc, char** argv) | |||
67 | extern char **environ; | 68 | extern char **environ; |
68 | 69 | ||
69 | bb_opt_complementally = "u::"; | 70 | bb_opt_complementally = "u::"; |
71 | #if ENABLE_FEATURE_ENV_LONG_OPTIONS | ||
70 | bb_applet_long_options = env_long_options; | 72 | bb_applet_long_options = env_long_options; |
73 | #endif | ||
71 | 74 | ||
72 | opt = bb_getopt_ulflags(argc, argv, "+iu:", &unset_env); | 75 | opt = bb_getopt_ulflags(argc, argv, "+iu:", &unset_env); |
73 | 76 | ||
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 @@ | |||
39 | #define INSTALL_OPT_MODE 32 | 39 | #define INSTALL_OPT_MODE 32 |
40 | #define INSTALL_OPT_OWNER 64 | 40 | #define INSTALL_OPT_OWNER 64 |
41 | 41 | ||
42 | #if ENABLE_FEATURE_INSTALL_LONG_OPTIONS | ||
42 | static const struct option install_long_options[] = { | 43 | static const struct option install_long_options[] = { |
43 | { "directory", 0, NULL, 'd' }, | 44 | { "directory", 0, NULL, 'd' }, |
44 | { "preserve-timestamps", 0, NULL, 'p' }, | 45 | { "preserve-timestamps", 0, NULL, 'p' }, |
@@ -48,6 +49,7 @@ static const struct option install_long_options[] = { | |||
48 | { "owner", 0, NULL, 'o' }, | 49 | { "owner", 0, NULL, 'o' }, |
49 | { 0, 0, 0, 0 } | 50 | { 0, 0, 0, 0 } |
50 | }; | 51 | }; |
52 | #endif | ||
51 | 53 | ||
52 | int install_main(int argc, char **argv) | 54 | int install_main(int argc, char **argv) |
53 | { | 55 | { |
@@ -60,7 +62,9 @@ int install_main(int argc, char **argv) | |||
60 | int copy_flags = FILEUTILS_DEREFERENCE | FILEUTILS_FORCE; | 62 | int copy_flags = FILEUTILS_DEREFERENCE | FILEUTILS_FORCE; |
61 | int ret = EXIT_SUCCESS, flags, i, isdir; | 63 | int ret = EXIT_SUCCESS, flags, i, isdir; |
62 | 64 | ||
65 | #if ENABLE_FEATURE_INSTALL_LONG_OPTIONS | ||
63 | bb_applet_long_options = install_long_options; | 66 | bb_applet_long_options = install_long_options; |
67 | #endif | ||
64 | bb_opt_complementally = "?:s--d:d--s"; | 68 | bb_opt_complementally = "?:s--d:d--s"; |
65 | /* -c exists for backwards compatibility, its needed */ | 69 | /* -c exists for backwards compatibility, its needed */ |
66 | flags = bb_getopt_ulflags(argc, argv, "cdpsg:m:o:", &gid_str, &mode_str, &uid_str); /* 'a' must be 2nd */ | 70 | 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 @@ | |||
34 | #include <getopt.h> /* struct option */ | 34 | #include <getopt.h> /* struct option */ |
35 | #include "busybox.h" | 35 | #include "busybox.h" |
36 | 36 | ||
37 | #if ENABLE_FEATURE_MKDIR_LONG_OPTIONS | ||
37 | static const struct option mkdir_long_options[] = { | 38 | static const struct option mkdir_long_options[] = { |
38 | { "mode", 1, NULL, 'm' }, | 39 | { "mode", 1, NULL, 'm' }, |
39 | { "parents", 0, NULL, 'p' }, | 40 | { "parents", 0, NULL, 'p' }, |
40 | { 0, 0, 0, 0 } | 41 | { 0, 0, 0, 0 } |
41 | }; | 42 | }; |
43 | #endif | ||
42 | 44 | ||
43 | int mkdir_main (int argc, char **argv) | 45 | int mkdir_main (int argc, char **argv) |
44 | { | 46 | { |
@@ -48,7 +50,9 @@ int mkdir_main (int argc, char **argv) | |||
48 | unsigned long opt; | 50 | unsigned long opt; |
49 | char *smode; | 51 | char *smode; |
50 | 52 | ||
53 | #if ENABLE_FEATURE_MKDIR_LONG_OPTIONS | ||
51 | bb_applet_long_options = mkdir_long_options; | 54 | bb_applet_long_options = mkdir_long_options; |
55 | #endif | ||
52 | opt = bb_getopt_ulflags(argc, argv, "m:p", &smode); | 56 | opt = bb_getopt_ulflags(argc, argv, "m:p", &smode); |
53 | if(opt & 1) { | 57 | if(opt & 1) { |
54 | mode = 0777; | 58 | 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 @@ | |||
35 | #include "busybox.h" | 35 | #include "busybox.h" |
36 | #include "libcoreutils/coreutils.h" | 36 | #include "libcoreutils/coreutils.h" |
37 | 37 | ||
38 | #if ENABLE_FEATURE_MV_LONG_OPTIONS | ||
38 | static const struct option mv_long_options[] = { | 39 | static const struct option mv_long_options[] = { |
39 | { "interactive", 0, NULL, 'i' }, | 40 | { "interactive", 0, NULL, 'i' }, |
40 | { "force", 0, NULL, 'f' }, | 41 | { "force", 0, NULL, 'f' }, |
41 | { 0, 0, 0, 0 } | 42 | { 0, 0, 0, 0 } |
42 | }; | 43 | }; |
44 | #endif | ||
43 | 45 | ||
44 | #define OPT_FILEUTILS_FORCE 1 | 46 | #define OPT_FILEUTILS_FORCE 1 |
45 | #define OPT_FILEUTILS_INTERACTIVE 2 | 47 | #define OPT_FILEUTILS_INTERACTIVE 2 |
@@ -55,7 +57,9 @@ int mv_main(int argc, char **argv) | |||
55 | int dest_exists; | 57 | int dest_exists; |
56 | int status = 0; | 58 | int status = 0; |
57 | 59 | ||
60 | #if ENABLE_FEATURE_MV_LONG_OPTIONS | ||
58 | bb_applet_long_options = mv_long_options; | 61 | bb_applet_long_options = mv_long_options; |
62 | #endif | ||
59 | bb_opt_complementally = "f-i:i-f"; | 63 | bb_opt_complementally = "f-i:i-f"; |
60 | flags = bb_getopt_ulflags(argc, argv, "fi"); | 64 | flags = bb_getopt_ulflags(argc, argv, "fi"); |
61 | if (optind + 2 > argc) { | 65 | if (optind + 2 > argc) { |