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

PATCH: Re: ${-str}



Sven wrote
> > Tanaka Akira <akr@xxxxxxxx> typed:
> > :Z(4):akr@serein% Src/zsh -f             
> > :serein% print -lr ${-str}
> > :569XZfims
>
> Shouldn't we change this to be an error? Or do we really need this for 
> compatibility?

Is this correct?  All the parameter tests still seem to work.  The first
hunk simply removes an unneeded local variable.  The change already picked
up an extraneous closing brace in _vars_eq, which is also patched.

Index: Completion/Builtins/_vars_eq
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Builtins/_vars_eq,v
retrieving revision 1.6
diff -u -r1.6 _vars_eq
--- Completion/Builtins/_vars_eq	2000/05/15 00:31:20	1.6
+++ Completion/Builtins/_vars_eq	2000/05/15 15:01:42
@@ -45,7 +45,7 @@
   export) use="${${use/g/}/x/}" ;;
 esac
 
-[[ -z "${words[(r)-*f*]]}" ]] || func=f
+[[ -z "${words[(r)-*f*]}" ]] || func=f
 [[ -z "${words[(r)-*[aA]*]}" ]] || func=p
    
 for ((i=1;i<=$#use;++i)); do
Index: Src/subst.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/subst.c,v
retrieving revision 1.4
diff -u -r1.4 subst.c
--- Src/subst.c	2000/05/08 08:58:37	1.4
+++ Src/subst.c	2000/05/15 15:01:42
@@ -1463,10 +1463,12 @@
 		}
 	    }
 	    {
+#if 1
+		singsub(&s);
+#else
 		char t = s[-1];
 
 		singsub(&s);
-#if 0
 		/*
 		 * This allows # and % to be at the start of
 		 * a parameter in the substitution, which is
@@ -1543,6 +1545,10 @@
 	}
 	if (!inbrace)
 	    fstr = s;
+	else if (s != fstr && *s) {
+	    zerr("garbage in parameter substitution: %s", s, 0);
+	    return NULL;
+	}
     }
     if (errflag)
 	return NULL;

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxxxxxxxxxx>
Cambridge Silicon Radio, Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070



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