diff options
Diffstat (limited to 'coreutils/test.c')
-rw-r--r-- | coreutils/test.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/coreutils/test.c b/coreutils/test.c index ae40192a2..ab7b41684 100644 --- a/coreutils/test.c +++ b/coreutils/test.c | |||
@@ -571,7 +571,14 @@ static number_t nexpr(enum token n) | |||
571 | 571 | ||
572 | nest_msg(">nexpr(%s)\n", TOKSTR[n]); | 572 | nest_msg(">nexpr(%s)\n", TOKSTR[n]); |
573 | if (n == UNOT) { | 573 | if (n == UNOT) { |
574 | res = !nexpr(check_operator(*++args)); | 574 | n = check_operator(*++args); |
575 | if (n == EOI) { | ||
576 | /* special case: [ ! ], [ a -a ! ] are valid */ | ||
577 | /* IOW, "! ARG" may miss ARG */ | ||
578 | unnest_msg("<nexpr:1 (!EOI)\n"); | ||
579 | return 1; | ||
580 | } | ||
581 | res = !nexpr(n); | ||
575 | unnest_msg("<nexpr:%lld\n", res); | 582 | unnest_msg("<nexpr:%lld\n", res); |
576 | return res; | 583 | return res; |
577 | } | 584 | } |
@@ -742,7 +749,7 @@ int test_main(int argc, char **argv) | |||
742 | check_operator(argv[1]); | 749 | check_operator(argv[1]); |
743 | if (last_operator->op_type == BINOP) { | 750 | if (last_operator->op_type == BINOP) { |
744 | /* "test [!] arg1 <binary_op> arg2" */ | 751 | /* "test [!] arg1 <binary_op> arg2" */ |
745 | args = &argv[0]; | 752 | args = argv; |
746 | res = (binop() == 0); | 753 | res = (binop() == 0); |
747 | goto ret; | 754 | goto ret; |
748 | } | 755 | } |
@@ -755,7 +762,7 @@ int test_main(int argc, char **argv) | |||
755 | argv--; | 762 | argv--; |
756 | } | 763 | } |
757 | #endif | 764 | #endif |
758 | args = &argv[0]; | 765 | args = argv; |
759 | res = !oexpr(check_operator(*args)); | 766 | res = !oexpr(check_operator(*args)); |
760 | 767 | ||
761 | if (*args != NULL && *++args != NULL) { | 768 | if (*args != NULL && *++args != NULL) { |