diff options
author | Denys Vlasenko | 2018-04-01 03:04:55 +0200 |
---|---|---|
committer | Denys Vlasenko | 2018-04-01 03:04:55 +0200 |
commit | 1e5111b0f80b1f3d7f2fc8254cb70de067317403 (patch) | |
tree | ee7a49ce2dad513159b7c62e43d7a645950bf207 /shell/hush.c | |
parent | 32e183e63ecb46595a480ab66120795ed9c9e0df (diff) | |
download | busybox-1e5111b0f80b1f3d7f2fc8254cb70de067317403.zip busybox-1e5111b0f80b1f3d7f2fc8254cb70de067317403.tar.gz |
ash,hush: handle a few more bkslash-newline cases
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/hush.c')
-rw-r--r-- | shell/hush.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/shell/hush.c b/shell/hush.c index 533d45a..4b8641d 100644 --- a/shell/hush.c +++ b/shell/hush.c @@ -4980,8 +4980,14 @@ static struct pipe *parse_stream(char **pstring, nommu_addchr(&ctx.as_string, ch); next = '\0'; - if (ch != '\n') + if (ch != '\n') { next = i_peek(input); + /* Can't use i_peek_and_eat_bkslash_nl(input) here: + * echo '\ + * ' + * will break. + */ + } is_special = "{}<>;&|()#'" /* special outside of "str" */ "\\$\"" IF_HUSH_TICK("`") /* always special */ @@ -5375,7 +5381,7 @@ static struct pipe *parse_stream(char **pstring, /* Eat multiple semicolons, detect * whether it means something special */ while (1) { - ch = i_peek(input); + ch = i_peek_and_eat_bkslash_nl(input); if (ch != ';') break; ch = i_getch(input); @@ -5397,6 +5403,8 @@ static struct pipe *parse_stream(char **pstring, if (done_word(&dest, &ctx)) { goto parse_error; } + if (next == '\\') + next = i_peek_and_eat_bkslash_nl(input); if (next == '&') { ch = i_getch(input); nommu_addchr(&ctx.as_string, ch); @@ -5413,6 +5421,8 @@ static struct pipe *parse_stream(char **pstring, if (ctx.ctx_res_w == RES_MATCH) break; /* we are in case's "word | word)" */ #endif + if (next == '\\') + next = i_peek_and_eat_bkslash_nl(input); if (next == '|') { /* || */ ch = i_getch(input); nommu_addchr(&ctx.as_string, ch); |