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

Re: core dumps with (( #\... ))



Sven Wischnowsky wrote:
> > Should I change it but keep \ for backward compatibility?
> 
> That would be kind.

This is not hard.

--- Doc/Zsh/arith.yo.mchar	Tue Sep 21 11:25:32 1999
+++ Doc/Zsh/arith.yo	Thu Sep 23 15:43:36 1999
@@ -86,13 +86,14 @@
 arithmetic expressions. The shell currently defines no mathematical
 functions, but modules may define some.
 
-An expression of the form `tt(#\)var(x)' where var(x) is any character
+An expression of the form `tt(##)var(x)' where var(x) is any character
 sequence such as `tt(a)', `tt(^A)', or `tt(\M-\C-x)' gives the ascii
 value of this character and an expression of the form `tt(#)var(foo)'
 gives the ascii value of the first character of the value of the
 parameter var(foo).  Note that this is different from the expression
 `tt($#)var(foo)', a standard parameter substitution which gives the
-length of the parameter var(foo).
+length of the parameter var(foo).  `tt(#\)' is accepted instead of
+`tt(##)', but its use is deprecated.
 
 Named parameters and subscripted arrays can be referenced by name within an
 arithmetic expression without using the parameter expansion syntax.  For
--- Src/math.c.mchar	Thu Sep 23 15:42:18 1999
+++ Src/math.c	Thu Sep 23 15:42:20 1999
@@ -374,7 +374,7 @@
 		return NUM;
 	    }
 	    if (*ptr == '#') {
-		if (*++ptr == '\\') {
+		if (*++ptr == '\\' || *ptr == '#') {
 		    int v;
 
 		    ptr++;

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxx>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy



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