Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: unset -v (was Re: printf and POSIX compliance)

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.


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 @@
 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.

Messages sorted by: Reverse Date, Date, Thread, Author