mirror of
git://git.code.sf.net/p/zsh/code
synced 2024-09-22 03:40:47 +02:00
18015: empty math parse acts like zero
This commit is contained in:
parent
9a8dfbb7b5
commit
99c9b50bb4
@ -1,5 +1,7 @@
|
||||
2002-12-18 Peter Stephenson <pws@csr.com>
|
||||
|
||||
* 18015: Src/math.c: empty math parse e.g. $(( )) acts like a zero.
|
||||
|
||||
* 18013: Src/builtin.c, Src/exec.c: let and (( ... )) should
|
||||
return zero status on floating point only if the value compares
|
||||
equal to 0 as a floating point number.
|
||||
|
@ -961,7 +961,7 @@ mathevall(char *s, int prek, char **ep)
|
||||
stack[0].val.u.l = 0;
|
||||
mathparse(prek);
|
||||
*ep = ptr;
|
||||
DPUTS(!errflag && sp,
|
||||
DPUTS(!errflag && sp > 0,
|
||||
"BUG: math: wallabies roaming too freely in outback");
|
||||
|
||||
if (errflag) {
|
||||
@ -1084,6 +1084,9 @@ mathparse(int pc)
|
||||
if (errflag)
|
||||
return;
|
||||
mtok = zzlex();
|
||||
/* Handle empty input */
|
||||
if (pc == TOPPREC && mtok == EOI)
|
||||
return;
|
||||
checkunary(mtok, optr);
|
||||
while (prec[mtok] <= pc) {
|
||||
if (errflag)
|
||||
|
Loading…
Reference in New Issue
Block a user