From fc6c76519b863f38ab650e0e82fce574c5dc98e1 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Thu, 25 Nov 2010 10:34:32 +0000 Subject: 28434: make ${NAME:OFFSET} always use zero-offset --- Src/subst.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'Src/subst.c') 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--; -- cgit 1.4.1