diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2016-11-23 18:31:48 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2016-11-23 18:31:48 +0100 |
commit | 15fb91cefb22d64952f34fe246fc8f257172af63 (patch) | |
tree | b26c3168f2ea5e185eee1041c6f521855398783a /coreutils/test.c | |
parent | 73f743a381dc389287d2d0e56a2b7988f67c0bfc (diff) | |
download | busybox-w32-15fb91cefb22d64952f34fe246fc8f257172af63.tar.gz busybox-w32-15fb91cefb22d64952f34fe246fc8f257172af63.tar.bz2 busybox-w32-15fb91cefb22d64952f34fe246fc8f257172af63.zip |
test: make [ and [[ forms individually selectable
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils/test.c')
-rw-r--r-- | coreutils/test.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/coreutils/test.c b/coreutils/test.c index 81c9b7dfe..9e18ee986 100644 --- a/coreutils/test.c +++ b/coreutils/test.c | |||
@@ -27,19 +27,33 @@ | |||
27 | //config: returning an appropriate exit code. The bash shell | 27 | //config: returning an appropriate exit code. The bash shell |
28 | //config: has test built in, ash can build it in optionally. | 28 | //config: has test built in, ash can build it in optionally. |
29 | //config: | 29 | //config: |
30 | //config:config TEST1 | ||
31 | //config: bool "test as [" | ||
32 | //config: default y | ||
33 | //config: help | ||
34 | //config: Provide test command in the "[ EXPR ]" form | ||
35 | //config: | ||
36 | //config:config TEST2 | ||
37 | //config: bool "test as [[" | ||
38 | //config: default y | ||
39 | //config: help | ||
40 | //config: Provide test command in the "[[ EXPR ]]" form | ||
41 | //config: | ||
30 | //config:config FEATURE_TEST_64 | 42 | //config:config FEATURE_TEST_64 |
31 | //config: bool "Extend test to 64 bit" | 43 | //config: bool "Extend test to 64 bit" |
32 | //config: default y | 44 | //config: default y |
33 | //config: depends on TEST || ASH_BUILTIN_TEST || HUSH | 45 | //config: depends on TEST || TEST1 || TEST2 || ASH_BUILTIN_TEST || HUSH |
34 | //config: help | 46 | //config: help |
35 | //config: Enable 64-bit support in test. | 47 | //config: Enable 64-bit support in test. |
36 | 48 | ||
37 | //applet:IF_TEST(APPLET_NOFORK([, test, BB_DIR_USR_BIN, BB_SUID_DROP, test)) | ||
38 | //applet:IF_TEST(APPLET_NOFORK([[, test, BB_DIR_USR_BIN, BB_SUID_DROP, test)) | ||
39 | //applet:IF_TEST(APPLET_NOFORK(test, test, BB_DIR_USR_BIN, BB_SUID_DROP, test)) | 49 | //applet:IF_TEST(APPLET_NOFORK(test, test, BB_DIR_USR_BIN, BB_SUID_DROP, test)) |
50 | //applet:IF_TEST1(APPLET_NOFORK([, test, BB_DIR_USR_BIN, BB_SUID_DROP, test)) | ||
51 | //applet:IF_TEST2(APPLET_NOFORK([[, test, BB_DIR_USR_BIN, BB_SUID_DROP, test)) | ||
40 | 52 | ||
41 | //kbuild:lib-$(CONFIG_TEST) += test.o test_ptr_hack.o | 53 | //kbuild:lib-$(CONFIG_TEST) += test.o test_ptr_hack.o |
42 | //kbuild:lib-$(CONFIG_ASH) += test.o test_ptr_hack.o | 54 | //kbuild:lib-$(CONFIG_TEST1) += test.o test_ptr_hack.o |
55 | //kbuild:lib-$(CONFIG_TEST2) += test.o test_ptr_hack.o | ||
56 | //kbuild:lib-$(CONFIG_ASH_BUILTIN_TEST) += test.o test_ptr_hack.o | ||
43 | //kbuild:lib-$(CONFIG_HUSH) += test.o test_ptr_hack.o | 57 | //kbuild:lib-$(CONFIG_HUSH) += test.o test_ptr_hack.o |
44 | 58 | ||
45 | /* "test --help" is special-cased to ignore --help */ | 59 | /* "test --help" is special-cased to ignore --help */ |
@@ -827,7 +841,9 @@ int test_main(int argc, char **argv) | |||
827 | const char *arg0; | 841 | const char *arg0; |
828 | 842 | ||
829 | arg0 = bb_basename(argv[0]); | 843 | arg0 = bb_basename(argv[0]); |
830 | if (arg0[0] == '[') { | 844 | if ((ENABLE_TEST1 || ENABLE_TEST2 || ENABLE_ASH_BUILTIN_TEST || ENABLE_HUSH) |
845 | && (arg0[0] == '[') | ||
846 | ) { | ||
831 | --argc; | 847 | --argc; |
832 | if (!arg0[1]) { /* "[" ? */ | 848 | if (!arg0[1]) { /* "[" ? */ |
833 | if (NOT_LONE_CHAR(argv[argc], ']')) { | 849 | if (NOT_LONE_CHAR(argv[argc], ']')) { |