same as previous, but -100 bytes
This commit is contained in:
parent
bf25fbccb9
commit
9f8d938172
22
shell/hush.c
22
shell/hush.c
@ -5476,11 +5476,9 @@ static struct pipe *parse_stream(char **pstring,
|
|||||||
* will still trigger for us */
|
* will still trigger for us */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (end_trigger && end_trigger == ch
|
|
||||||
&& (heredoc_cnt == 0 || end_trigger != ';')
|
/* "cmd}" or "cmd }..." without semicolon or &:
|
||||||
) {
|
* } is an ordinary char in this case, even inside { cmd; }
|
||||||
/* "{ cmd}" or "{ cmd }..." without semicolon or &:
|
|
||||||
* } is an ordinary char in this case.
|
|
||||||
* Pathological example: { ""}; } should exec "}" cmd
|
* Pathological example: { ""}; } should exec "}" cmd
|
||||||
*/
|
*/
|
||||||
if (ch == '}'
|
if (ch == '}'
|
||||||
@ -5492,6 +5490,10 @@ static struct pipe *parse_stream(char **pstring,
|
|||||||
) {
|
) {
|
||||||
goto ordinary_char;
|
goto ordinary_char;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (end_trigger && end_trigger == ch
|
||||||
|
&& (heredoc_cnt == 0 || end_trigger != ';')
|
||||||
|
) {
|
||||||
if (heredoc_cnt) {
|
if (heredoc_cnt) {
|
||||||
/* This is technically valid:
|
/* This is technically valid:
|
||||||
* { cat <<HERE; }; echo Ok
|
* { cat <<HERE; }; echo Ok
|
||||||
@ -5757,16 +5759,6 @@ static struct pipe *parse_stream(char **pstring,
|
|||||||
goto case_semi;
|
goto case_semi;
|
||||||
#endif
|
#endif
|
||||||
case '}':
|
case '}':
|
||||||
if (!(IS_NULL_PIPE(ctx.pipe)
|
|
||||||
&& IS_NULL_CMD(ctx.command)
|
|
||||||
&& dest.length == 0
|
|
||||||
&& !dest.o_quoted
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
/* } not preceded by ; or & is an ordinary
|
|
||||||
* char, example: "echo }" */
|
|
||||||
goto ordinary_char;
|
|
||||||
}
|
|
||||||
/* proper use of this character is caught by end_trigger:
|
/* proper use of this character is caught by end_trigger:
|
||||||
* if we see {, we call parse_group(..., end_trigger='}')
|
* if we see {, we call parse_group(..., end_trigger='}')
|
||||||
* and it will match } earlier (not here). */
|
* and it will match } earlier (not here). */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user