aboutsummaryrefslogtreecommitdiff
path: root/coreutils/test.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2005-04-14 02:49:22 +0000
committerMike Frysinger <vapier@gentoo.org>2005-04-14 02:49:22 +0000
commit75ac42b1aea14abbd8633003a6c56fa28c27a6c9 (patch)
treedcb9edcbd4e973f31208ed9aaec7d1c1def5d18e /coreutils/test.c
parentc089ccdb441cf1493e974fa2ed4f9ac22c5637c7 (diff)
downloadbusybox-w32-75ac42b1aea14abbd8633003a6c56fa28c27a6c9.tar.gz
busybox-w32-75ac42b1aea14abbd8633003a6c56fa28c27a6c9.tar.bz2
busybox-w32-75ac42b1aea14abbd8633003a6c56fa28c27a6c9.zip
add aliases == and [[ for = and [ to support more bash scripts
Diffstat (limited to 'coreutils/test.c')
-rw-r--r--coreutils/test.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/coreutils/test.c b/coreutils/test.c
index 8fa6d166f..cec3c471d 100644
--- a/coreutils/test.c
+++ b/coreutils/test.c
@@ -51,7 +51,7 @@
51 unary-operator ::= "-r"|"-w"|"-x"|"-f"|"-d"|"-c"|"-b"|"-p"| 51 unary-operator ::= "-r"|"-w"|"-x"|"-f"|"-d"|"-c"|"-b"|"-p"|
52 "-u"|"-g"|"-k"|"-s"|"-t"|"-z"|"-n"|"-o"|"-O"|"-G"|"-L"|"-S"; 52 "-u"|"-g"|"-k"|"-s"|"-t"|"-z"|"-n"|"-o"|"-O"|"-G"|"-L"|"-S";
53 53
54 binary-operator ::= "="|"!="|"-eq"|"-ne"|"-ge"|"-gt"|"-le"|"-lt"| 54 binary-operator ::= "="|"=="|"!="|"-eq"|"-ne"|"-ge"|"-gt"|"-le"|"-lt"|
55 "-nt"|"-ot"|"-ef"; 55 "-nt"|"-ot"|"-ef";
56 operand ::= <any legal UNIX file name> 56 operand ::= <any legal UNIX file name>
57*/ 57*/
@@ -135,6 +135,7 @@ static const struct t_op {
135 "-L", FILSYM, UNOP}, { 135 "-L", FILSYM, UNOP}, {
136 "-S", FILSOCK, UNOP}, { 136 "-S", FILSOCK, UNOP}, {
137 "=", STREQ, BINOP}, { 137 "=", STREQ, BINOP}, {
138 "==", STREQ, BINOP}, {
138 "!=", STRNE, BINOP}, { 139 "!=", STRNE, BINOP}, {
139 "<", STRLT, BINOP}, { 140 "<", STRLT, BINOP}, {
140 ">", STRGT, BINOP}, { 141 ">", STRGT, BINOP}, {
@@ -191,6 +192,11 @@ extern int test_main(int argc, char **argv)
191 bb_error_msg_and_die("missing ]"); 192 bb_error_msg_and_die("missing ]");
192 argv[argc] = NULL; 193 argv[argc] = NULL;
193 } 194 }
195 if (strcmp(bb_applet_name, "[[") == 0) {
196 if (strcmp(argv[--argc], "]]"))
197 bb_error_msg_and_die("missing ]]");
198 argv[argc] = NULL;
199 }
194 /* Implement special cases from POSIX.2, section 4.62.4 */ 200 /* Implement special cases from POSIX.2, section 4.62.4 */
195 switch (argc) { 201 switch (argc) {
196 case 1: 202 case 1: