mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-11-17 23:51:06 +01:00
41866: No error unsetting nonexistent function for POSIXBUILTINS
This commit is contained in:
parent
2273fe478a
commit
bf04ffb542
3 changed files with 11 additions and 1 deletions
|
|
@ -1,3 +1,8 @@
|
|||
2017-11-02 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
||||
|
||||
* Martijn: 41866: Src/builtin.c, Src/hashtable.c: no error for
|
||||
unsetting nonexistent function if POSIXBUILTINS.
|
||||
|
||||
2017-10-31 Oliver Kiddle <opk@zsh.org>
|
||||
|
||||
* 41965: Completion/Zsh/Command/_typeset: complete functions -W
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ static struct builtin builtins[] =
|
|||
BUILTIN("unalias", 0, bin_unhash, 0, -1, BIN_UNALIAS, "ams", NULL),
|
||||
BUILTIN("unfunction", 0, bin_unhash, 1, -1, BIN_UNFUNCTION, "m", "f"),
|
||||
BUILTIN("unhash", 0, bin_unhash, 1, -1, BIN_UNHASH, "adfms", NULL),
|
||||
BUILTIN("unset", BINF_PSPECIAL, bin_unset, 1, -1, 0, "fmv", NULL),
|
||||
BUILTIN("unset", BINF_PSPECIAL, bin_unset, 1, -1, BIN_UNSET, "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, "acmpvfsSwx:", NULL),
|
||||
|
|
@ -4158,6 +4158,10 @@ bin_unhash(char *name, char **argv, Options ops, int func)
|
|||
for (; *argv; argv++) {
|
||||
if ((hn = ht->removenode(ht, *argv))) {
|
||||
ht->freenode(hn);
|
||||
} else if (func == BIN_UNSET && isset(POSIXBUILTINS)) {
|
||||
/* POSIX: unset: "Unsetting a variable or function that was *
|
||||
* not previously set shall not be considered an error." */
|
||||
returnval = 0;
|
||||
} else {
|
||||
zwarnnam(name, "no such hash table element: %s", *argv);
|
||||
returnval = 1;
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@
|
|||
#define BIN_UNHASH 28
|
||||
#define BIN_UNALIAS 29
|
||||
#define BIN_UNFUNCTION 30
|
||||
#define BIN_UNSET 31
|
||||
|
||||
/* These currently depend on being 0 and 1. */
|
||||
#define BIN_SETOPT 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue