summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2009-04-19 14:03:11 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2009-04-19 14:03:11 +0000
commit9f8d9381727fa517bbe3adf4f18e856a936057a7 (patch)
tree4e54e0cb62ffbdcd5ffe466ffd68e1f20b4f1ccd /shell
parentbf25fbccb9b2641c77685ac0a537e8068b6b354a (diff)
downloadbusybox-w32-9f8d9381727fa517bbe3adf4f18e856a936057a7.tar.gz
busybox-w32-9f8d9381727fa517bbe3adf4f18e856a936057a7.tar.bz2
busybox-w32-9f8d9381727fa517bbe3adf4f18e856a936057a7.zip
same as previous, but -100 bytes
Diffstat (limited to 'shell')
-rw-r--r--shell/hush.c38
1 files changed, 15 insertions, 23 deletions
diff --git a/shell/hush.c b/shell/hush.c
index 62b1d48b4..c542b7dd9 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -5476,22 +5476,24 @@ static struct pipe *parse_stream(char **pstring,
5476 * will still trigger for us */ 5476 * will still trigger for us */
5477 } 5477 }
5478 } 5478 }
5479
5480 /* "cmd}" or "cmd }..." without semicolon or &:
5481 * } is an ordinary char in this case, even inside { cmd; }
5482 * Pathological example: { ""}; } should exec "}" cmd
5483 */
5484 if (ch == '}'
5485 && !(IS_NULL_PIPE(ctx.pipe)
5486 && IS_NULL_CMD(ctx.command)
5487 && dest.length == 0
5488 && !dest.o_quoted
5489 )
5490 ) {
5491 goto ordinary_char;
5492 }
5493
5479 if (end_trigger && end_trigger == ch 5494 if (end_trigger && end_trigger == ch
5480 && (heredoc_cnt == 0 || end_trigger != ';') 5495 && (heredoc_cnt == 0 || end_trigger != ';')
5481 ) { 5496 ) {
5482 /* "{ cmd}" or "{ cmd }..." without semicolon or &:
5483 * } is an ordinary char in this case.
5484 * Pathological example: { ""}; } should exec "}" cmd
5485 */
5486 if (ch == '}'
5487 && !(IS_NULL_PIPE(ctx.pipe)
5488 && IS_NULL_CMD(ctx.command)
5489 && dest.length == 0
5490 && !dest.o_quoted
5491 )
5492 ) {
5493 goto ordinary_char;
5494 }
5495 if (heredoc_cnt) { 5497 if (heredoc_cnt) {
5496 /* This is technically valid: 5498 /* This is technically valid:
5497 * { cat <<HERE; }; echo Ok 5499 * { cat <<HERE; }; echo Ok
@@ -5757,16 +5759,6 @@ static struct pipe *parse_stream(char **pstring,
5757 goto case_semi; 5759 goto case_semi;
5758#endif 5760#endif
5759 case '}': 5761 case '}':
5760 if (!(IS_NULL_PIPE(ctx.pipe)
5761 && IS_NULL_CMD(ctx.command)
5762 && dest.length == 0
5763 && !dest.o_quoted
5764 )
5765 ) {
5766 /* } not preceded by ; or & is an ordinary
5767 * char, example: "echo }" */
5768 goto ordinary_char;
5769 }
5770 /* proper use of this character is caught by end_trigger: 5762 /* proper use of this character is caught by end_trigger:
5771 * if we see {, we call parse_group(..., end_trigger='}') 5763 * if we see {, we call parse_group(..., end_trigger='}')
5772 * and it will match } earlier (not here). */ 5764 * and it will match } earlier (not here). */