diff --git a/expr.c b/expr.c index 7b5f260979a9f3348b499d589b59f117a865a17e..e0da86a48c085dbd836816bfc46dc6180a9f25e4 100644 --- a/expr.c +++ b/expr.c @@ -187,7 +187,7 @@ static int parseSubExpr(const char **pp, long *v, int pr, int o) long val3 = 0; val2 = 1; if (exprDebug) printf("parseExpr(%d) if %ld ...\n", pr, val); - if (parseExpr(&p, &val2) >= 0) + if ((o2 = parseExpr(&p, &val2)) >= 0) { if (parseSep(&p, ":")) { diff --git a/testscript b/testscript index fe0beb4aef0ac9473590b2ca82cba10892e10a6d..dfda1c51c1ab827af13ca7942b478abc8ca6a07b 100644 --- a/testscript +++ b/testscript @@ -72,8 +72,8 @@ x=1-1?0?1:2:3?4:5 x=1-1?0?1:2:3-3?4:5 # $(x) should be: 5 -x=0?; 1?; 2?; -4? -# $(x) should be: 0; 1; 1; 1 +x=0?; 1?; 2?; -4?; 3?+1 +# $(x) should be: 0; 1; 1; 1; 4 x=a030b a(030)b a( 030 )b "a"030"b" a(%x 030)b # $(x) should be: a030b a24b a24b a24b a18b