From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5251 invoked from network); 15 Nov 1998 20:49:45 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 15 Nov 1998 20:49:45 -0000 Received: (from list@localhost) by math.gatech.edu (8.9.1/8.9.1) id PAA01215; Sun, 15 Nov 1998 15:48:51 -0500 (EST) Resent-Date: Sun, 15 Nov 1998 15:48:51 -0500 (EST) From: "Bart Schaefer" Message-Id: <981115124721.ZM29110@candle.brasslantern.com> Date: Sun, 15 Nov 1998 12:47:21 -0800 In-Reply-To: Comments: In reply to Timothy Writer "Re: PATCH: 3.1.5 - sample associative array implementation" (Nov 13, 8:55pm) References: <9811111358.AA51361@ibmth.df.unipi.it> <981111125236.ZM3587@candle.brasslantern.com> <981112012358.ZM9722@candle.brasslantern.com> <981112173201.ZM13829@candle.brasslantern.com> X-Mailer: Z-Mail (4.0b.820 20aug96) To: zsh-workers@math.gatech.edu Subject: PATCH: 3.1.5 + associative arrays under ksh emulation MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: <"s11pQ.0.wI.pupJs"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/4641 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu On Nov 13, 8:55pm, Timothy Writer wrote: } Subject: Re: PATCH: 3.1.5 - sample associative array implementation } } In ksh93, $arrayname is a synonym for ${arrayname[0]}. This appears to be } true for indexed arrays _and_ associative arrays. Index: Src/params.c =================================================================== --- params.c 1998/11/12 09:21:35 1.8 +++ params.c 1998/11/15 20:39:19 @@ -1055,6 +1055,13 @@ switch(PM_TYPE(v->pm->flags)) { case PM_HASHED: + /* (!v->isarr) should be impossible unless emulating ksh */ + if (!v->isarr && emulation == EMULATE_KSH) { + s = dupstring("[0]"); + if (getindex(&s, v) == 0) + s = getstrvalue(v); + LASTALLOC_RETURN s; + } /* else fall through */ case PM_ARRAY: ss = getvaluearr(v); if (v->isarr) -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com