diff options
author | Nikias Bassen | 2019-10-11 23:16:05 +0200 |
---|---|---|
committer | Nikias Bassen | 2019-10-11 23:16:05 +0200 |
commit | bd85a1bd5a8dd8cce74a9235011f866402a23c59 (patch) | |
tree | 7b46fcd11448c4b118cc6fcf7ddc0379e9c34b60 /src/common.c | |
parent | 767fcceaeb456f5e281a6bd1b3f51713e4989293 (diff) | |
download | idevicerestore-bd85a1bd5a8dd8cce74a9235011f866402a23c59.tar.gz idevicerestore-bd85a1bd5a8dd8cce74a9235011f866402a23c59.tar.bz2 |
win32: Use signal on win32 but make sure user input can be cancelled with ctrl+c
also added ESC key as a fallback cancel method.
Diffstat (limited to 'src/common.c')
-rw-r--r-- | src/common.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/common.c b/src/common.c index f9377ba..a54ae6f 100644 --- a/src/common.c +++ b/src/common.c @@ -506,7 +506,9 @@ char* realpath(const char *filename, char *resolved_name) #ifdef WIN32 #define BS_CC '\b' -#define my_getch getch +#define CTRL_C_CC 0x03 +#define ESC_CC 0x1B +#define my_getch _getch #else #define BS_CC 0x7f static int my_getch(void) @@ -541,6 +543,12 @@ void get_user_input(char *buf, int maxlen, int secure) len--; } } +#ifdef WIN32 + else if (c == CTRL_C_CC || c == ESC_CC) { + c = -1; + break; + } +#endif } if (c < 0) { len = 0; |