mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-11 13:01:28 +02:00
zsh-workers/9367
This commit is contained in:
parent
377fde4b22
commit
31a13a8931
4 changed files with 28 additions and 6 deletions
|
@ -43,7 +43,8 @@ evalcond(Estate state)
|
||||||
{
|
{
|
||||||
struct stat *st;
|
struct stat *st;
|
||||||
char *left, *right = NULL;
|
char *left, *right = NULL;
|
||||||
wordcode code = *state->pc++;
|
Wordcode pcode = state->pc++;
|
||||||
|
wordcode code = *pcode;
|
||||||
int ctype = WC_COND_TYPE(code);
|
int ctype = WC_COND_TYPE(code);
|
||||||
|
|
||||||
switch (ctype) {
|
switch (ctype) {
|
||||||
|
@ -57,7 +58,7 @@ evalcond(Estate state)
|
||||||
fprintf(stderr, " %s", condstr[ctype]);
|
fprintf(stderr, " %s", condstr[ctype]);
|
||||||
return evalcond(state);
|
return evalcond(state);
|
||||||
} else {
|
} else {
|
||||||
state->pc += WC_COND_SKIP(code) - 1;
|
state->pc = pcode + (WC_COND_SKIP(code) + 1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COND_OR:
|
case COND_OR:
|
||||||
|
@ -66,7 +67,7 @@ evalcond(Estate state)
|
||||||
fprintf(stderr, " %s", condstr[ctype]);
|
fprintf(stderr, " %s", condstr[ctype]);
|
||||||
return evalcond(state);
|
return evalcond(state);
|
||||||
} else {
|
} else {
|
||||||
state->pc += WC_COND_SKIP(code) - 1;
|
state->pc = pcode + (WC_COND_SKIP(code) + 1);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
case COND_MOD:
|
case COND_MOD:
|
||||||
|
|
11
Src/parse.c
11
Src/parse.c
|
@ -1727,7 +1727,7 @@ yyerror(int noerr)
|
||||||
* Word code layout:
|
* Word code layout:
|
||||||
*
|
*
|
||||||
* WC_END
|
* WC_END
|
||||||
* - only used for empty functions
|
* - end of program code
|
||||||
*
|
*
|
||||||
* WC_LIST
|
* WC_LIST
|
||||||
* - data contains type (sync, ...)
|
* - data contains type (sync, ...)
|
||||||
|
@ -2217,6 +2217,14 @@ ecomp(struct node *n)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case N_COND:
|
||||||
|
eccond((Cond) n);
|
||||||
|
break;
|
||||||
|
#ifdef DEBUG
|
||||||
|
default:
|
||||||
|
dputs("BUG: node type not handled in ecomp().");
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2335,7 +2343,6 @@ execompile(List list)
|
||||||
ecsoffs = ecnpats = 0;
|
ecsoffs = ecnpats = 0;
|
||||||
|
|
||||||
ec(list);
|
ec(list);
|
||||||
if (!ecused)
|
|
||||||
ecadd(WCB_END());
|
ecadd(WCB_END());
|
||||||
|
|
||||||
ret = (Eprog) zhalloc(sizeof(*ret));
|
ret = (Eprog) zhalloc(sizeof(*ret));
|
||||||
|
|
|
@ -191,6 +191,11 @@
|
||||||
1:null redir with NULLCMD unset
|
1:null redir with NULLCMD unset
|
||||||
?ZTST_execchunk:2: redirection with no command
|
?ZTST_execchunk:2: redirection with no command
|
||||||
|
|
||||||
|
echo this should still work >out1
|
||||||
|
print "$(<out1)"
|
||||||
|
0:null redir in $(...) with NULLCMD unset
|
||||||
|
>this should still work
|
||||||
|
|
||||||
READNULLCMD=cat
|
READNULLCMD=cat
|
||||||
print cat input >out1
|
print cat input >out1
|
||||||
<out1
|
<out1
|
||||||
|
|
|
@ -140,3 +140,12 @@
|
||||||
|
|
||||||
[[ -e /dev/fd/0 ]]
|
[[ -e /dev/fd/0 ]]
|
||||||
0:/dev/fd support in conds
|
0:/dev/fd support in conds
|
||||||
|
|
||||||
|
[[ ( -z foo && -z foo ) || -z foo ]]
|
||||||
|
1:complex conds with skipping
|
||||||
|
|
||||||
|
[ '' != bar -a '' = '' ]
|
||||||
|
0:strings with `[' builtin
|
||||||
|
|
||||||
|
[ `echo 0` -lt `echo 1` ]
|
||||||
|
0:substituion in `[' builtin
|
||||||
|
|
Loading…
Reference in a new issue