summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2010-11-25 10:34:32 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2010-11-25 10:34:32 +0000
commitfc6c76519b863f38ab650e0e82fce574c5dc98e1 (patch)
treee8b04143855ec64e08084349de5d173a48c969a0 /Src
parent32a4c982065bff9829ef6be87095530c7acc96d3 (diff)
downloadzsh-fc6c76519b863f38ab650e0e82fce574c5dc98e1.tar.gz
zsh-fc6c76519b863f38ab650e0e82fce574c5dc98e1.tar.xz
zsh-fc6c76519b863f38ab650e0e82fce574c5dc98e1.zip
28434: make ${NAME:OFFSET} always use zero-offset
Diffstat (limited to 'Src')
-rw-r--r--Src/subst.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/Src/subst.c b/Src/subst.c
index 12825ff93..031a1affd 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -1640,7 +1640,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
     int subexp;
     /*
      * If we're referring to the positional parameters, then
-     * e.g ${*:1:1} refers to $1 even if KSH_ARRAYS is in effect.
+     * e.g ${*:1:1} refers to $1.
      * This is for compatibility.
      */
     int horrible_offset_hack = 0;
@@ -2768,16 +2768,15 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
 			return NULL;
 		    }
 		}
-		if (!isset(KSHARRAYS) || horrible_offset_hack) {
+		if (horrible_offset_hack) {
 		    /*
 		     * As part of the 'orrible hoffset 'ack,
 		     * (what hare you? Han 'orrible hoffset 'ack,
 		     * sergeant major), if we are given a ksh/bash/POSIX
-		     * style array which includes offset 0, we use
-		     * $0.
+		     * style positional parameter array which includes
+		     * offset 0, we use $0.
 		     */
-		    if (isset(KSHARRAYS) && horrible_offset_hack &&
-			offset == 0 && isarr) {
+		    if (offset == 0 && isarr) {
 			offset_hack_argzero = 1;
 		    } else if (offset > 0) {
 			offset--;