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

Re: PATCH: fix for $var[1,0] expansion



One thing I just noticed is that the two "subscript too small/big"
error messages have never output the correct array value for one-
relative arrays.  My just-released patch accidentally split the
difference so that it was only half right in 1-relative mode, but
also half right in ksh (0-relative) mode.  This patch should fix it
so that it works right all the time.

Index: params.c
@@ -1312,13 +1312,13 @@
     if (v->start > MAX_ARRLEN ||
 	v->start < -MAX_ARRLEN) {
 	zerr("subscript too %s: %d", (v->start < 0) ? "small" : "big",
-	     v->start);
+	     v->start + !isset(KSHARRAYS));
 	return NULL;
     }
     if (v->start + v->len > MAX_ARRLEN ||
 	v->start + v->len < -MAX_ARRLEN) {
 	zerr("subscript too %s: %d", (v->len < 0) ? "small" : "big",
-	     v->start + v->len);
+	     v->start + v->len - !!isset(KSHARRAYS));
 	return NULL;
     }
     return v;

..wayne..



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