aboutsummaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2007-06-15 10:36:49 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2007-06-15 10:36:49 +0000
commitbe9924394547da16396952dfd8bbfa7da96e644d (patch)
treef7eebd0347cb9e05206e72e41d5c21359bc3673e /coreutils
parent867266059b98ba56e2bfac45bf51e0f99b5d886d (diff)
downloadbusybox-be9924394547da16396952dfd8bbfa7da96e644d.tar.gz
- fix test -f ./exists
Note that test -f ./exists -a "-u" = "-u" doesn't work and did not work even before r18282, so this is a breakage not caused by me..
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/test.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/coreutils/test.c b/coreutils/test.c
index bbbfce58e..3796e2cd2 100644
--- a/coreutils/test.c
+++ b/coreutils/test.c
@@ -183,6 +183,7 @@ int bb_test(int argc, char **argv)
{
int res;
char *arg0;
+ bool _off;
arg0 = strrchr(argv[0], '/');
if (!arg0++) arg0 = argv[0];
@@ -224,15 +225,19 @@ int bb_test(int argc, char **argv)
if (argc == 2)
return *argv[1] == '\0';
//assert(argc);
+ /* remember if we saw argc==4 which wants *no* '!' test */
+ _off = argc - 4;
+ if (_off ?
+ (LONE_CHAR(argv[1], '!'))
+ : (argv[1][0] != '!' || argv[1][1] != '\0'))
{
- bool _off;
if (argc == 3)
return *argv[2] != '\0';
- _off = argc - 4;
+
t_lex(argv[2 + _off]);
if (t_wp_op && t_wp_op->op_type == BINOP) {
t_wp = &argv[1 + _off];
- return binop() == (LONE_CHAR(argv[1], '!'));
+ return binop() == _off;
}
}
t_wp = &argv[1];