From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3112 invoked from network); 12 Feb 1999 09:45:42 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 12 Feb 1999 09:45:42 -0000 Received: (qmail 2738 invoked by alias); 12 Feb 1999 09:45:20 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 5349 Received: (qmail 2731 invoked from network); 12 Feb 1999 09:45:17 -0000 Message-Id: <9902120928.AA34074@ibmth.df.unipi.it> To: zsh-workers@sunsite.auc.dk Subject: PATCH: zsh-3.1.5-pws-7: "$a[@]" with $a unset In-Reply-To: "Sven Wischnowsky"'s message of "Fri, 12 Feb 1999 09:53:59 NFT." <199902120853.JAA08542@beta.informatik.hu-berlin.de> Date: Fri, 12 Feb 1999 10:28:58 +0100 From: Peter Stephenson Sven Wischnowsky wrote: > % foo() { echo $# } > % unset a > % foo $a[@] > 0 # fine > % foo "$a[@]" > 1 # oops The code's a little murky (as in `hell is murky' --- or'ing with something is a pretty shoddy way of making a value negative, particularly when the SCANPM_ISVAR_AT flag is never seen again), but the following seems to do the trick. Note that putting `a=()' before would have been a workaround. > The same for `$a[*]' and `$a'. That's right, surely? Quoted variables only expand to nothing if the @ is present. --- Src/params.c.isarr Mon Feb 1 09:52:30 1999 +++ Src/params.c Fri Feb 12 10:14:14 1999 @@ -966,7 +966,7 @@ if (*tbrack == Outbrack) *tbrack = ']'; if ((s[0] == '*' || s[0] == '@') && s[1] == ']') { - if (v->isarr && s[0] == '@') + if ((v->isarr || !v->pm || !*v->pm->nam) && s[0] == '@') v->isarr |= SCANPM_ISVAR_AT; v->a = 0; v->b = -1; -- Peter Stephenson Tel: +39 050 844536 WWW: http://www.ifh.de/~pws/ Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy