From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6019 invoked from network); 15 Nov 1998 23:23:05 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 15 Nov 1998 23:23:05 -0000 Received: (from list@localhost) by math.gatech.edu (8.9.1/8.9.1) id SAA04462; Sun, 15 Nov 1998 18:21:07 -0500 (EST) Resent-Date: Sun, 15 Nov 1998 18:21:07 -0500 (EST) From: "Bart Schaefer" Message-Id: <981115151925.ZM30071@candle.brasslantern.com> Date: Sun, 15 Nov 1998 15:19:24 -0800 In-Reply-To: <981115144603.ZM29810@candle.brasslantern.com> Comments: In reply to "Bart Schaefer" "Re: Arithmetic expression (bug?)" (Nov 15, 2:46pm) References: <199811042134.VAA01156@athenaeum.demon.co.uk> <981115144603.ZM29810@candle.brasslantern.com> X-Mailer: Z-Mail (4.0b.820 20aug96) To: Phil Pennock , zsh-workers@math.gatech.edu Subject: PATCH: 3.1.5 and 3.0.5: ${(l)param} (was Re: Arithmetic expression (bug?)) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: <"HLkyM1.0.c51.Z7sJs"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/4644 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu On Nov 15, 2:46pm, Bart Schaefer wrote: } Subject: Re: Arithmetic expression (bug?) } } Having just said I wasn't sure how to fix this, here's a patch that takes } care of it. That patch didn't go far enough; it misses the case where two strings are passed to (l...) or (r...). Use this one instead (and this time I did remember to put the word PATCH in the subject). Index: Src/subst.c =================================================================== --- subst.c 1998/11/12 09:21:35 1.2 +++ subst.c 1998/11/15 22:27:52 @@ -743,6 +743,7 @@ long num; int escapes = 0; int klen; +#define UNTOK(C) (itok(C) ? ztokens[(C) - Pound] : (C)) #define UNTOK_AND_ESCAPE(X) {\ untokenize(X = dupstring(s + 1));\ if (escapes) {\ @@ -856,7 +857,7 @@ prenum = num; else postnum = num; - if (s[1] != sav) + if (UNTOK(s[1]) != UNTOK(sav)) break; t = get_strarg(++s); if (!*t) @@ -871,7 +871,7 @@ *t = sav; sav = *s; s = t + 1; - if (*s != sav) { + if (UNTOK(*s) != UNTOK(sav)) { s--; break; } -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com