From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26071 invoked from network); 11 Feb 2003 12:06:54 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 11 Feb 2003 12:06:54 -0000 Received: (qmail 26734 invoked by alias); 11 Feb 2003 12:06:37 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 18223 Received: (qmail 26727 invoked from network); 11 Feb 2003 12:06:37 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 11 Feb 2003 12:06:37 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [193.109.254.147] by sunsite.dk (MessageWall 1.0.8) with SMTP; 11 Feb 2003 12:6:36 -0000 X-VirusChecked: Checked X-Env-Sender: kiddleo@logica.com X-Msg-Ref: server-19.tower-27.messagelabs.com!1044965070!749 Received: (qmail 9562 invoked from network); 11 Feb 2003 12:04:30 -0000 Received: from iris.logica.co.uk (158.234.9.163) by server-19.tower-27.messagelabs.com with SMTP; 11 Feb 2003 12:04:30 -0000 Received: from finches.logica.co.uk ([158.234.142.11]) by iris.logica.co.uk (8.9.3/8.9.3/Debian 8.9.3-21) with ESMTP id MAA14731 for ; Tue, 11 Feb 2003 12:06:37 GMT X-Authentication-Warning: iris.logica.co.uk: Host [158.234.142.11] claimed to be finches.logica.co.uk Received: from finches.logica.co.uk (localhost [127.0.0.1]) by finches.logica.co.uk (8.11.6/8.11.6/SuSE Linux 0.5) with ESMTP id h1BC9vU20887 for ; Tue, 11 Feb 2003 13:09:57 +0100 To: zsh-workers@sunsite.dk In-reply-to: <18945.1044452527@csr.com> From: Oliver Kiddle References: <18945.1044452527@csr.com> Subject: PATCH: unset -v (was Re: printf and POSIX compliance) Date: Tue, 11 Feb 2003 13:09:56 +0100 Message-ID: <20885.1044965396@finches.logica.co.uk> Sender: kiddleo@logica.com On 5 Feb, Peter wrote: > > The Austin Group which is revising the standard is steering it through > IEEE, SUS and ISO procedures. If I've followed the developments > correctly, the 2002 version available at the Open Group site is now > approved by all relevant bodies, with identical wording. > > Unfortunately we're a bit erratic at following it; nobody's really got > the time to keep track of it in detail. It seems from it that one of the things it defines is that unset should take a -v flag to specify that variables are being unset. If neither -f nor -v is specified, it unsets variables. bash breaks this last condition (probably because older versions of the standard didn't define that) so unset -v is used a bit in bash scripts. Anyway, all we need to do is ignore any -v option to unset. Unless anyone says otherwise I'll commit this to 4.0 too because it is sufficiently tiny. Oliver diff -ur zsh-4.1-20030211/Doc/Zsh/builtins.yo zsh.new/Doc/Zsh/builtins.yo --- zsh-4.1-20030211/Doc/Zsh/builtins.yo Fri Feb 7 18:05:39 2003 +++ zsh.new/Doc/Zsh/builtins.yo Tue Feb 11 12:04:41 2003 @@ -1391,7 +1391,7 @@ ) findex(unset) cindex(parameters, unsetting) -item(tt(unset) [ tt(-fm) ] var(name) ...)( +item(tt(unset) [ tt(-fmv) ] var(name) ...)( Each named parameter is unset. Local parameters remain local even if unset; they appear unset within scope, but the previous value will still reappear when the scope ends. @@ -1404,6 +1404,9 @@ be quoted) and all parameters with matching names are unset. Note that this cannot be used when unsetting associative array elements, as the subscript will be treated as part of the pattern. + +The tt(-v) flag specifies that var(name) refers to parameters. This is the +default behaviour. tt(unset -f) is equivalent to tt(unfunction). ) diff -ur zsh-4.1-20030211/Src/builtin.c zsh.new/Src/builtin.c --- zsh-4.1-20030211/Src/builtin.c Fri Feb 7 18:05:41 2003 +++ zsh.new/Src/builtin.c Tue Feb 11 11:53:43 2003 @@ -126,7 +126,7 @@ BUILTIN("unalias", 0, bin_unhash, 1, -1, 0, "m", "a"), BUILTIN("unfunction", 0, bin_unhash, 1, -1, 0, "m", "f"), BUILTIN("unhash", 0, bin_unhash, 1, -1, 0, "adfm", NULL), - BUILTIN("unset", BINF_PSPECIAL, bin_unset, 1, -1, 0, "fm", NULL), + BUILTIN("unset", BINF_PSPECIAL, bin_unset, 1, -1, 0, "fmv", NULL), BUILTIN("unsetopt", 0, bin_setopt, 0, -1, BIN_UNSETOPT, NULL, NULL), BUILTIN("wait", 0, bin_fg, 0, -1, BIN_WAIT, NULL, NULL), BUILTIN("whence", 0, bin_whence, 0, -1, 0, "acmpvfsw", NULL), This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.