diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2020-11-16 13:09:37 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2020-11-16 13:09:37 +0100 |
commit | 4ac35a30db0c9badd9895c5eaa1d4d3a118b5259 (patch) | |
tree | 1e8a7a9fd690b5df9e5eb816dced7beebcc37834 | |
parent | dc9c10a7b29c93a36ff17c562cb14e11eb169f19 (diff) | |
download | busybox-w32-4ac35a30db0c9badd9895c5eaa1d4d3a118b5259.tar.gz busybox-w32-4ac35a30db0c9badd9895c5eaa1d4d3a118b5259.tar.bz2 busybox-w32-4ac35a30db0c9badd9895c5eaa1d4d3a118b5259.zip |
ash: make interactive ^C break out of PS2 mode
Based on patch by Joachim Nilsson <troglobit@gmail.com>
function old new delta
pgetc 570 547 -23
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | shell/ash.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/shell/ash.c b/shell/ash.c index 674a41bd3..d1ca3451d 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -10593,7 +10593,7 @@ preadfd(void) | |||
10593 | 10593 | ||
10594 | g_parsefile->next_to_pgetc = buf; | 10594 | g_parsefile->next_to_pgetc = buf; |
10595 | #if ENABLE_FEATURE_EDITING | 10595 | #if ENABLE_FEATURE_EDITING |
10596 | retry: | 10596 | /* retry: */ |
10597 | if (!iflag || g_parsefile->pf_fd != STDIN_FILENO) | 10597 | if (!iflag || g_parsefile->pf_fd != STDIN_FILENO) |
10598 | nr = nonblock_immune_read(g_parsefile->pf_fd, buf, IBUFSIZ - 1); | 10598 | nr = nonblock_immune_read(g_parsefile->pf_fd, buf, IBUFSIZ - 1); |
10599 | else { | 10599 | else { |
@@ -10615,15 +10615,14 @@ preadfd(void) | |||
10615 | if (nr == 0) { | 10615 | if (nr == 0) { |
10616 | /* ^C pressed, "convert" to SIGINT */ | 10616 | /* ^C pressed, "convert" to SIGINT */ |
10617 | write(STDOUT_FILENO, "^C", 2); | 10617 | write(STDOUT_FILENO, "^C", 2); |
10618 | raise(SIGINT); | ||
10618 | if (trap[SIGINT]) { | 10619 | if (trap[SIGINT]) { |
10619 | buf[0] = '\n'; | 10620 | buf[0] = '\n'; |
10620 | buf[1] = '\0'; | 10621 | buf[1] = '\0'; |
10621 | raise(SIGINT); | ||
10622 | return 1; | 10622 | return 1; |
10623 | } | 10623 | } |
10624 | exitstatus = 128 + SIGINT; | 10624 | exitstatus = 128 + SIGINT; |
10625 | bb_putchar('\n'); | 10625 | return -1; |
10626 | goto retry; | ||
10627 | } | 10626 | } |
10628 | if (nr < 0) { | 10627 | if (nr < 0) { |
10629 | if (errno == 0) { | 10628 | if (errno == 0) { |