diff options
Diffstat (limited to 'miscutils/bc.c')
-rw-r--r-- | miscutils/bc.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/miscutils/bc.c b/miscutils/bc.c index 28bc40c8b..31485ae9c 100644 --- a/miscutils/bc.c +++ b/miscutils/bc.c | |||
@@ -203,6 +203,9 @@ | |||
203 | 203 | ||
204 | #include "libbb.h" | 204 | #include "libbb.h" |
205 | #include "common_bufsiz.h" | 205 | #include "common_bufsiz.h" |
206 | #if ENABLE_PLATFORM_MINGW32 | ||
207 | # include "BB_VER.h" | ||
208 | #endif | ||
206 | 209 | ||
207 | #if !ENABLE_BC && !ENABLE_FEATURE_DC_BIG | 210 | #if !ENABLE_BC && !ENABLE_FEATURE_DC_BIG |
208 | # include "dc.c" | 211 | # include "dc.c" |
@@ -7466,6 +7469,17 @@ static unsigned xc_vm_envLen(const char *var) | |||
7466 | return len; | 7469 | return len; |
7467 | } | 7470 | } |
7468 | 7471 | ||
7472 | #if ENABLE_PLATFORM_MINGW32 && ENABLE_FEATURE_BC_INTERACTIVE | ||
7473 | static BOOL WINAPI ctrl_handler(DWORD dwCtrlType) | ||
7474 | { | ||
7475 | if (dwCtrlType == CTRL_C_EVENT || dwCtrlType == CTRL_BREAK_EVENT) { | ||
7476 | bb_got_signal = SIGINT; | ||
7477 | return TRUE; | ||
7478 | } | ||
7479 | return FALSE; | ||
7480 | } | ||
7481 | #endif | ||
7482 | |||
7469 | static int xc_vm_init(const char *env_len) | 7483 | static int xc_vm_init(const char *env_len) |
7470 | { | 7484 | { |
7471 | G.prog.len = xc_vm_envLen(env_len); | 7485 | G.prog.len = xc_vm_envLen(env_len); |
@@ -7491,7 +7505,11 @@ static int xc_vm_init(const char *env_len) | |||
7491 | // from stdin is not interrupted by ^C either, | 7505 | // from stdin is not interrupted by ^C either, |
7492 | // it restarts, thus fgetc() does not return on ^C. | 7506 | // it restarts, thus fgetc() does not return on ^C. |
7493 | // (This problem manifests only if line editing is disabled) | 7507 | // (This problem manifests only if line editing is disabled) |
7508 | # if !ENABLE_PLATFORM_MINGW32 | ||
7494 | signal_SA_RESTART_empty_mask(SIGINT, record_signo); | 7509 | signal_SA_RESTART_empty_mask(SIGINT, record_signo); |
7510 | # else | ||
7511 | SetConsoleCtrlHandler(ctrl_handler, TRUE); | ||
7512 | # endif | ||
7495 | 7513 | ||
7496 | // Without SA_RESTART, this exhibits a bug: | 7514 | // Without SA_RESTART, this exhibits a bug: |
7497 | // "while (1) print 1" and try ^C-ing it. | 7515 | // "while (1) print 1" and try ^C-ing it. |