Fix for w64devkit and mingw
This commit is contained in:
parent
dc271c52ed
commit
649098737d
1 changed files with 6 additions and 4 deletions
|
@ -47,6 +47,11 @@ void sigint_handler(int signo) {
|
|||
}
|
||||
}
|
||||
#endif
|
||||
#if defined (_WIN32)
|
||||
BOOL console_ctrl_handler(DWORD ctrl_type) {
|
||||
return (ctrl_type == CTRL_C_EVENT) ? (sigint_handler(SIGINT), true) : false;
|
||||
}
|
||||
#endif
|
||||
|
||||
int main(int argc, char ** argv) {
|
||||
gpt_params params;
|
||||
|
@ -241,10 +246,7 @@ int main(int argc, char ** argv) {
|
|||
sigint_action.sa_flags = 0;
|
||||
sigaction(SIGINT, &sigint_action, NULL);
|
||||
#elif defined (_WIN32)
|
||||
auto console_ctrl_handler = [](DWORD ctrl_type) -> BOOL {
|
||||
return (ctrl_type == CTRL_C_EVENT) ? (sigint_handler(SIGINT), true) : false;
|
||||
};
|
||||
SetConsoleCtrlHandler(static_cast<PHANDLER_ROUTINE>(console_ctrl_handler), true);
|
||||
SetConsoleCtrlHandler(console_ctrl_handler, true);
|
||||
#endif
|
||||
|
||||
fprintf(stderr, "%s: interactive mode on.\n", __func__);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue