diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2018-12-07 12:41:42 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2018-12-07 12:41:42 +0100 |
commit | b9c321d6d94fc8bbae5fe657e141cbd9f2397037 (patch) | |
tree | d5a590abe90f8d87a4d8253330dd2f6160f94421 /miscutils/bc.c | |
parent | c7a7ce06b82ef6a4e5f6146046792daf666e3c6d (diff) | |
download | busybox-w32-b9c321d6d94fc8bbae5fe657e141cbd9f2397037.tar.gz busybox-w32-b9c321d6d94fc8bbae5fe657e141cbd9f2397037.tar.bz2 busybox-w32-b9c321d6d94fc8bbae5fe657e141cbd9f2397037.zip |
bc: use only G_interrupt as interrupt flag
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'miscutils/bc.c')
-rw-r--r-- | miscutils/bc.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/miscutils/bc.c b/miscutils/bc.c index 45cdeae7f..0330c43e5 100644 --- a/miscutils/bc.c +++ b/miscutils/bc.c | |||
@@ -771,11 +771,12 @@ struct globals { | |||
771 | #define G_posix (ENABLE_BC && (option_mask32 & BC_FLAG_S)) | 771 | #define G_posix (ENABLE_BC && (option_mask32 & BC_FLAG_S)) |
772 | #define G_warn (ENABLE_BC && (option_mask32 & BC_FLAG_W)) | 772 | #define G_warn (ENABLE_BC && (option_mask32 & BC_FLAG_W)) |
773 | #define G_exreg (ENABLE_DC && (option_mask32 & DC_FLAG_X)) | 773 | #define G_exreg (ENABLE_DC && (option_mask32 & DC_FLAG_X)) |
774 | #define G_interrupt (ENABLE_FEATURE_BC_SIGNALS ? bb_got_signal : 0) | ||
775 | #if ENABLE_FEATURE_BC_SIGNALS | 774 | #if ENABLE_FEATURE_BC_SIGNALS |
776 | # define G_ttyin G.ttyin | 775 | # define G_interrupt bb_got_signal |
776 | # define G_ttyin G.ttyin | ||
777 | #else | 777 | #else |
778 | # define G_ttyin 0 | 778 | # define G_interrupt 0 |
779 | # define G_ttyin 0 | ||
779 | #endif | 780 | #endif |
780 | #if ENABLE_FEATURE_CLEAN_UP | 781 | #if ENABLE_FEATURE_CLEAN_UP |
781 | # define G_exiting G.exiting | 782 | # define G_exiting G.exiting |
@@ -1262,9 +1263,9 @@ static BcStatus bc_read_line(BcVec *vec, const char *prompt) | |||
1262 | fflush_and_check(); | 1263 | fflush_and_check(); |
1263 | 1264 | ||
1264 | #if ENABLE_FEATURE_BC_SIGNALS | 1265 | #if ENABLE_FEATURE_BC_SIGNALS |
1265 | if (bb_got_signal) { // ^C was pressed | 1266 | if (G_interrupt) { // ^C was pressed |
1266 | intr: | 1267 | intr: |
1267 | bb_got_signal = 0; // resets G_interrupt to zero | 1268 | G_interrupt = 0; |
1268 | fputs(IS_BC | 1269 | fputs(IS_BC |
1269 | ? "\ninterrupt (type \"quit\" to exit)\n" | 1270 | ? "\ninterrupt (type \"quit\" to exit)\n" |
1270 | : "\ninterrupt (type \"q\" to exit)\n" | 1271 | : "\ninterrupt (type \"q\" to exit)\n" |
@@ -1299,7 +1300,7 @@ static BcStatus bc_read_line(BcVec *vec, const char *prompt) | |||
1299 | c = fgetc(stdin); | 1300 | c = fgetc(stdin); |
1300 | #if ENABLE_FEATURE_BC_SIGNALS && !ENABLE_FEATURE_EDITING | 1301 | #if ENABLE_FEATURE_BC_SIGNALS && !ENABLE_FEATURE_EDITING |
1301 | // Both conditions appear simultaneously, check both just in case | 1302 | // Both conditions appear simultaneously, check both just in case |
1302 | if (errno == EINTR || bb_got_signal) { | 1303 | if (errno == EINTR || G_interrupt) { |
1303 | // ^C was pressed | 1304 | // ^C was pressed |
1304 | clearerr(stdin); | 1305 | clearerr(stdin); |
1305 | goto intr; | 1306 | goto intr; |