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

Re: PATCH: fixing ${1+"$@"} when word-splitting



On Mon, Feb 13, 2006 at 11:34:38AM +0000, Peter Stephenson wrote:
>   local IFS=.-
>   print -l ${=1:-1.2}
[...]
> but now gives
> 1.2

This is due to the multi_isarr weirdness:  when it is 0, multsub()
returns the resulting array joined with $IFS[0], which is what was
occurring here.  I added this line to fix the problem:

--- Src/subst.c	2006-02-13 09:25:18.000000000 -0800
+++ Src/subst.c	2006-02-13 09:30:33.000000000 -0800
@@ -347,6 +347,7 @@
 		if (!*x)
 		    break;
 		insertlinknode(&foo, n, (void *)x), incnode(n);
+		mult_isarr = 1;
 	    }
 	    switch (c) {
 	    case Dnull:

This makes sure that when we split the string into multiple pieces
before parsing it, it will be returned as an array.

..wayne..



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