aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--toys/posix/test.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/toys/posix/test.c b/toys/posix/test.c
index 87a866a7..cf6e1f50 100644
--- a/toys/posix/test.c
+++ b/toys/posix/test.c
@@ -102,7 +102,7 @@ void test_main(void)
if (toys.optc) for (pos = paren = pstack = 0; ; pos++) {
int len = toys.optc-pos;
- if (!toys.optargs[pos]) perror_exit("need arg @%d", pos);
+ if (!len) perror_exit("need arg @%d", pos);
// Evaluate next test
result = do_test(toys.optargs+pos, &len);
@@ -132,14 +132,14 @@ void test_main(void)
else if (pstack&AND) result = 0;
// Do it again for every )
- if (!paren || !s || strcmp(")", s)) break;
+ if (!paren || pos==toys.optc || strcmp(")", s)) break;
paren--;
pstack >>= 3;
s = toys.optargs[++pos];
}
// Out of arguments?
- if (!s) {
+ if (pos==toys.optc) {
if (paren) perror_exit("need )");
break;
}