bc: use only G_interrupt as interrupt flag
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
c7a7ce06b8
commit
b9c321d6d9
@ -771,10 +771,11 @@ struct globals {
|
|||||||
#define G_posix (ENABLE_BC && (option_mask32 & BC_FLAG_S))
|
#define G_posix (ENABLE_BC && (option_mask32 & BC_FLAG_S))
|
||||||
#define G_warn (ENABLE_BC && (option_mask32 & BC_FLAG_W))
|
#define G_warn (ENABLE_BC && (option_mask32 & BC_FLAG_W))
|
||||||
#define G_exreg (ENABLE_DC && (option_mask32 & DC_FLAG_X))
|
#define G_exreg (ENABLE_DC && (option_mask32 & DC_FLAG_X))
|
||||||
#define G_interrupt (ENABLE_FEATURE_BC_SIGNALS ? bb_got_signal : 0)
|
|
||||||
#if ENABLE_FEATURE_BC_SIGNALS
|
#if ENABLE_FEATURE_BC_SIGNALS
|
||||||
|
# define G_interrupt bb_got_signal
|
||||||
# define G_ttyin G.ttyin
|
# define G_ttyin G.ttyin
|
||||||
#else
|
#else
|
||||||
|
# define G_interrupt 0
|
||||||
# define G_ttyin 0
|
# define G_ttyin 0
|
||||||
#endif
|
#endif
|
||||||
#if ENABLE_FEATURE_CLEAN_UP
|
#if ENABLE_FEATURE_CLEAN_UP
|
||||||
@ -1262,9 +1263,9 @@ static BcStatus bc_read_line(BcVec *vec, const char *prompt)
|
|||||||
fflush_and_check();
|
fflush_and_check();
|
||||||
|
|
||||||
#if ENABLE_FEATURE_BC_SIGNALS
|
#if ENABLE_FEATURE_BC_SIGNALS
|
||||||
if (bb_got_signal) { // ^C was pressed
|
if (G_interrupt) { // ^C was pressed
|
||||||
intr:
|
intr:
|
||||||
bb_got_signal = 0; // resets G_interrupt to zero
|
G_interrupt = 0;
|
||||||
fputs(IS_BC
|
fputs(IS_BC
|
||||||
? "\ninterrupt (type \"quit\" to exit)\n"
|
? "\ninterrupt (type \"quit\" to exit)\n"
|
||||||
: "\ninterrupt (type \"q\" to exit)\n"
|
: "\ninterrupt (type \"q\" to exit)\n"
|
||||||
@ -1299,7 +1300,7 @@ static BcStatus bc_read_line(BcVec *vec, const char *prompt)
|
|||||||
c = fgetc(stdin);
|
c = fgetc(stdin);
|
||||||
#if ENABLE_FEATURE_BC_SIGNALS && !ENABLE_FEATURE_EDITING
|
#if ENABLE_FEATURE_BC_SIGNALS && !ENABLE_FEATURE_EDITING
|
||||||
// Both conditions appear simultaneously, check both just in case
|
// Both conditions appear simultaneously, check both just in case
|
||||||
if (errno == EINTR || bb_got_signal) {
|
if (errno == EINTR || G_interrupt) {
|
||||||
// ^C was pressed
|
// ^C was pressed
|
||||||
clearerr(stdin);
|
clearerr(stdin);
|
||||||
goto intr;
|
goto intr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user