diff options
author | Denys Vlasenko <dvlasenk@redhat.com> | 2011-01-07 15:16:05 +0100 |
---|---|---|
committer | Denys Vlasenko <dvlasenk@redhat.com> | 2011-01-07 15:16:05 +0100 |
commit | 642e71a789156a96bcb18e6c5a0f52416c49d3b5 (patch) | |
tree | c04b16ed5297d297298ec19cb1d48b4d60c4775f | |
parent | f42c7b8fc161f5b3eb4e9c13f392daf7a11760c8 (diff) | |
download | busybox-w32-642e71a789156a96bcb18e6c5a0f52416c49d3b5.tar.gz busybox-w32-642e71a789156a96bcb18e6c5a0f52416c49d3b5.tar.bz2 busybox-w32-642e71a789156a96bcb18e6c5a0f52416c49d3b5.zip |
hush: fix wrong prompt problem on empty interactive commants
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
-rw-r--r-- | shell/hush.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/shell/hush.c b/shell/hush.c index a771e9cd9..24b9e6efe 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -4140,7 +4140,16 @@ static struct pipe *parse_stream(char **pstring, | |||
4140 | if (IS_NULL_CMD(ctx.command) | 4140 | if (IS_NULL_CMD(ctx.command) |
4141 | && dest.length == 0 && !dest.has_quoted_part | 4141 | && dest.length == 0 && !dest.has_quoted_part |
4142 | ) { | 4142 | ) { |
4143 | continue; | 4143 | /* This newline can be ignored. But... |
4144 | * without the below check, interactive shell | ||
4145 | * will ignore even lines with bare <newline>, | ||
4146 | * and show the continuation prompt: | ||
4147 | * ps1_prompt$ <enter> | ||
4148 | * ps2> _ <=== wrong prompt, should be ps1 | ||
4149 | */ | ||
4150 | struct pipe *pi = ctx.list_head; | ||
4151 | if (pi->num_cmds != 0) | ||
4152 | continue; | ||
4144 | } | 4153 | } |
4145 | /* Treat newline as a command separator. */ | 4154 | /* Treat newline as a command separator. */ |
4146 | done_pipe(&ctx, PIPE_SEQ); | 4155 | done_pipe(&ctx, PIPE_SEQ); |