1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-02 22:11:54 +02:00

28783: allow parentheses to be special in more places with SH_GLOB

This commit is contained in:
Peter Stephenson 2011-02-21 11:32:47 +00:00
parent 0e792b9447
commit 73ebca4fe9
4 changed files with 26 additions and 4 deletions

View file

@ -1,5 +1,9 @@
2011-02-21 Peter Stephenson <pws@csr.com>
* 28783: Doc/Zsh/options.yo, Src/lex.c, Test/A01grammar.ztst:
allow ( to be treated specially in more places when SH_GLOB
is set but KSH_GLOB isn't.
* 28784: Doc/Zsh/options.yo, Test/A04redirect.ztst, Src/exec.c:
exit on exec redirection error with POSIXBUILTINS.
@ -14238,5 +14242,5 @@
*****************************************************
* This is used by the shell to define $ZSH_PATCHLEVEL
* $Revision: 1.5204 $
* $Revision: 1.5205 $
*****************************************************

View file

@ -683,8 +683,12 @@ item(tt(SH_GLOB) <K> <S>)(
Disables the special meaning of `tt(LPAR())', `tt(|)', `tt(RPAR())'
and 'tt(<)' for globbing the result of parameter and command substitutions,
and in some other places where
the shell accepts patterns. This option is set by default if zsh is
invoked as tt(sh) or tt(ksh).
the shell accepts patterns. If tt(SH_GLOB) is set but tt(KSH_GLOB) is
not, the shell allows the interpretation of
subshell expressions enclosed in parentheses in some cases where there
is no space before the opening parenthesis, e.g. tt(!LPAR()true+RPAR())
is interpreted as if there were a space after the tt(!). This option is
set by default if zsh is invoked as tt(sh) or tt(ksh).
)
pindex(UNSET)
pindex(NO_UNSET)

View file

@ -877,7 +877,7 @@ gettok(void)
dbparens = 1;
return DINPAR;
}
if (incmdpos) {
if (incmdpos || (isset(SHGLOB) && !isset(KSHGLOB))) {
len = 0;
bptr = tokstr = (char *) hcalloc(bsiz = 32);
switch (cmd_or_math(CS_MATH)) {
@ -1141,6 +1141,8 @@ gettokstr(int c, int sub)
break;
if (incasepat && !len)
return INPAR;
if (!isset(KSHGLOB) && len)
goto brk;
}
if (!in_brace_param) {
if (!sub) {

View file

@ -577,3 +577,15 @@
0:$0 is traditionally if bizarrely set to the first argument with -c
>myargzero
>myargone
(setopt shglob
eval '
if ! (echo success1); then echo failure1; fi
if !(echo success2); then echo failure2; fi
print -l one two | while(read foo)do(print read it)done
')
0:Parentheses in shglob
>success1
>success2
>read it
>read it