diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2007-12-12 18:43:28 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2007-12-12 18:43:28 +0000 |
commit | 64c85ae68ab10392ecc6ef6a7a55c48e11ddb58f (patch) | |
tree | 4eb0b4fd47368e072111e0933b752a1ae72ca845 /Src | |
parent | 765f73823ec2aca73bc64db25d28d28df8d13e04 (diff) | |
download | zsh-64c85ae68ab10392ecc6ef6a7a55c48e11ddb58f.tar.gz zsh-64c85ae68ab10392ecc6ef6a7a55c48e11ddb58f.tar.xz zsh-64c85ae68ab10392ecc6ef6a7a55c48e11ddb58f.zip |
users/12325: implement OSI rules for test & [, add more doc warnings
Diffstat (limited to 'Src')
-rw-r--r-- | Src/builtin.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Src/builtin.c b/Src/builtin.c index 2e0d249f3..7bd4c6d83 100644 --- a/Src/builtin.c +++ b/Src/builtin.c @@ -5506,6 +5506,7 @@ bin_test(char *name, char **argv, UNUSED(Options ops), int func) char **s; Eprog prog; struct estate state; + int nargs; /* if "test" was invoked as "[", it needs a matching "]" * * which is subsequently ignored */ @@ -5521,6 +5522,20 @@ bin_test(char *name, char **argv, UNUSED(Options ops), int func) if (!*argv) return 1; + /* + * Implement some XSI extensions to POSIX here. + * See + * http://www.opengroup.org/onlinepubs/009695399/utilities/test.html. + */ + nargs = arrlen(argv); + if (nargs == 3 || nargs == 4) + { + if (*argv[0] == '(' && *argv[nargs-1] == ')') { + argv[nargs-1] = NULL; + argv++; + } + } + testargs = argv; tok = NULLTOK; condlex = testlex; |