summary refs log tree commit diff
path: root/Src/params.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@users.sourceforge.net>2000-06-01 20:52:26 +0000
committerWayne Davison <wayned@users.sourceforge.net>2000-06-01 20:52:26 +0000
commit4fddbb8f5cabc0ae4f84dff3688485cdff5fc262 (patch)
tree2c3ad75908482c04b13168b0223efe89eb0518c4 /Src/params.c
parent2d512418de40639f2e144b714b3c5d1759781959 (diff)
downloadzsh-4fddbb8f5cabc0ae4f84dff3688485cdff5fc262.tar.gz
zsh-4fddbb8f5cabc0ae4f84dff3688485cdff5fc262.tar.xz
zsh-4fddbb8f5cabc0ae4f84dff3688485cdff5fc262.zip
Made $array[0,0] work just like $array[0].
Diffstat (limited to 'Src/params.c')
-rw-r--r--Src/params.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Src/params.c b/Src/params.c
index e478bba0e..0f20c2b93 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -941,7 +941,7 @@ getarg(char **str, int *inv, Value v, int a2, zlong *w)
 	    r = isset(KSHARRAYS) ? 1 : 0;
 	} else {
 	    r = mathevalarg(s, &s);
-	    if ((!r && !a2) || (isset(KSHARRAYS) && r >= 0))
+	    if (isset(KSHARRAYS) && r >= 0)
 		r++;
 	}
 	if (word && !v->isarr) {
@@ -1185,19 +1185,19 @@ getindex(char **pptr, Value v)
 	} else {
 	    int com;
 
-	    if (start > 0)
-		start--;
 	    if ((com = (*s == ','))) {
 		s++;
 		len = getarg(&s, &inv, v, 1, &dummy);
 		if (len > 0) {
-		    len -= start;
+		    len -= start - 1;
 		    if (len < 0)
 			len = 0;
 		}
 	    } else {
 		len = wlen ? wlen : 1;
 	    }
+	    if (start > 0)
+		start--;
 	    if (*s == ']' || *s == Outbrack) {
 		s++;
 		if (v->isarr && len == 1 && !com &&