Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: return status of let with floats



Oliver Kiddle wrote:
> All of bash, pdksh and ksh 88/93 output 0 for `echo $(( ))' by the way
> while zsh gives a bad math expression error so that should perhaps also
> be changed.

This handles that particular case, though I don't know if it's supposed
to be something more general.

Index: Src/math.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/math.c,v
retrieving revision 1.16
diff -u -r1.16 math.c
--- Src/math.c	30 Oct 2002 19:29:42 -0000	1.16
+++ Src/math.c	18 Dec 2002 17:58:44 -0000
@@ -961,7 +961,7 @@
     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 @@
     if (errflag)
 	return;
     mtok = zzlex();
+    /* Handle empty input */
+    if (pc == TOPPREC && mtok == EOI)
+	return;
     checkunary(mtok, optr);
     while (prec[mtok] <= pc) {
 	if (errflag)

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070


**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
prohibited.  
If you received this in error, please contact the sender and 
delete the material from any computer.
**********************************************************************



Messages sorted by: Reverse Date, Date, Thread, Author