From 4cd4eb43320de6ecccb3b69087daee325d0bbfc1 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sun, 2 Aug 2009 20:18:29 +0200 Subject: apply post-1.14.2 patches Signed-off-by: Denys Vlasenko --- coreutils/test.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'coreutils/test.c') diff --git a/coreutils/test.c b/coreutils/test.c index ae40192..ab7b416 100644 --- a/coreutils/test.c +++ b/coreutils/test.c @@ -571,7 +571,14 @@ static number_t nexpr(enum token n) nest_msg(">nexpr(%s)\n", TOKSTR[n]); if (n == UNOT) { - res = !nexpr(check_operator(*++args)); + n = check_operator(*++args); + if (n == EOI) { + /* special case: [ ! ], [ a -a ! ] are valid */ + /* IOW, "! ARG" may miss ARG */ + unnest_msg("op_type == BINOP) { /* "test [!] arg1 arg2" */ - args = &argv[0]; + args = argv; res = (binop() == 0); goto ret; } @@ -755,7 +762,7 @@ int test_main(int argc, char **argv) argv--; } #endif - args = &argv[0]; + args = argv; res = !oexpr(check_operator(*args)); if (*args != NULL && *++args != NULL) { -- cgit v1.1