diff options
-rw-r--r-- | editors/vi.c | 9 | ||||
-rw-r--r-- | include/platform.h | 2 | ||||
-rw-r--r-- | scripts/defconfig.mingw32 | 20 | ||||
-rw-r--r-- | win32/termios.c | 6 |
4 files changed, 26 insertions, 11 deletions
diff --git a/editors/vi.c b/editors/vi.c index 602fc61d9..f59d5a706 100644 --- a/editors/vi.c +++ b/editors/vi.c | |||
@@ -2211,11 +2211,20 @@ static void catch_sig(int sig) | |||
2211 | 2211 | ||
2212 | static int mysleep(int hund) // sleep for 'hund' 1/100 seconds or stdin ready | 2212 | static int mysleep(int hund) // sleep for 'hund' 1/100 seconds or stdin ready |
2213 | { | 2213 | { |
2214 | #if ENABLE_PLATFORM_MINGW32 | ||
2215 | HANDLE h = GetStdHandle(STD_INPUT_HANDLE); | ||
2216 | DWORD ret; | ||
2217 | |||
2218 | fflush(stdout); | ||
2219 | ret = WaitForSingleObject(h, hund*10); | ||
2220 | return ret != WAIT_TIMEOUT; | ||
2221 | #else | ||
2214 | struct pollfd pfd[1]; | 2222 | struct pollfd pfd[1]; |
2215 | 2223 | ||
2216 | pfd[0].fd = STDIN_FILENO; | 2224 | pfd[0].fd = STDIN_FILENO; |
2217 | pfd[0].events = POLLIN; | 2225 | pfd[0].events = POLLIN; |
2218 | return safe_poll(pfd, 1, hund*10) > 0; | 2226 | return safe_poll(pfd, 1, hund*10) > 0; |
2227 | #endif | ||
2219 | } | 2228 | } |
2220 | 2229 | ||
2221 | //----- IO Routines -------------------------------------------- | 2230 | //----- IO Routines -------------------------------------------- |
diff --git a/include/platform.h b/include/platform.h index 232fead89..2b3ad42bd 100644 --- a/include/platform.h +++ b/include/platform.h | |||
@@ -379,6 +379,7 @@ typedef unsigned smalluint; | |||
379 | 379 | ||
380 | #if ENABLE_PLATFORM_MINGW32 | 380 | #if ENABLE_PLATFORM_MINGW32 |
381 | # undef HAVE_FDPRINTF | 381 | # undef HAVE_FDPRINTF |
382 | # undef HAVE_MEMRCHR | ||
382 | # undef HAVE_MKDTEMP | 383 | # undef HAVE_MKDTEMP |
383 | # undef HAVE_SETBIT | 384 | # undef HAVE_SETBIT |
384 | # undef HAVE_STRCASESTR | 385 | # undef HAVE_STRCASESTR |
@@ -413,6 +414,7 @@ extern int fdprintf(int fd, const char *format, ...); | |||
413 | #endif | 414 | #endif |
414 | 415 | ||
415 | #ifndef HAVE_MEMRCHR | 416 | #ifndef HAVE_MEMRCHR |
417 | #include <stddef.h> | ||
416 | extern void *memrchr(const void *s, int c, size_t n) FAST_FUNC; | 418 | extern void *memrchr(const void *s, int c, size_t n) FAST_FUNC; |
417 | #endif | 419 | #endif |
418 | 420 | ||
diff --git a/scripts/defconfig.mingw32 b/scripts/defconfig.mingw32 index 754b9514b..7fa01ffe0 100644 --- a/scripts/defconfig.mingw32 +++ b/scripts/defconfig.mingw32 | |||
@@ -358,21 +358,21 @@ CONFIG_FEATURE_DIFF_DIR=y | |||
358 | CONFIG_ED=y | 358 | CONFIG_ED=y |
359 | # CONFIG_PATCH is not set | 359 | # CONFIG_PATCH is not set |
360 | CONFIG_SED=y | 360 | CONFIG_SED=y |
361 | # CONFIG_VI is not set | 361 | CONFIG_VI=y |
362 | CONFIG_FEATURE_VI_MAX_LEN=0 | 362 | CONFIG_FEATURE_VI_MAX_LEN=4096 |
363 | # CONFIG_FEATURE_VI_8BIT is not set | 363 | # CONFIG_FEATURE_VI_8BIT is not set |
364 | # CONFIG_FEATURE_VI_COLON is not set | 364 | CONFIG_FEATURE_VI_COLON=y |
365 | # CONFIG_FEATURE_VI_YANKMARK is not set | 365 | CONFIG_FEATURE_VI_YANKMARK=y |
366 | # CONFIG_FEATURE_VI_SEARCH is not set | 366 | CONFIG_FEATURE_VI_SEARCH=y |
367 | # CONFIG_FEATURE_VI_USE_SIGNALS is not set | 367 | # CONFIG_FEATURE_VI_USE_SIGNALS is not set |
368 | # CONFIG_FEATURE_VI_DOT_CMD is not set | 368 | CONFIG_FEATURE_VI_DOT_CMD=y |
369 | # CONFIG_FEATURE_VI_READONLY is not set | 369 | CONFIG_FEATURE_VI_READONLY=y |
370 | # CONFIG_FEATURE_VI_SETOPTS is not set | 370 | CONFIG_FEATURE_VI_SETOPTS=y |
371 | # CONFIG_FEATURE_VI_SET is not set | 371 | CONFIG_FEATURE_VI_SET=y |
372 | # CONFIG_FEATURE_VI_WIN_RESIZE is not set | 372 | # CONFIG_FEATURE_VI_WIN_RESIZE is not set |
373 | # CONFIG_FEATURE_VI_ASK_TERMINAL is not set | 373 | # CONFIG_FEATURE_VI_ASK_TERMINAL is not set |
374 | # CONFIG_FEATURE_VI_OPTIMIZE_CURSOR is not set | 374 | # CONFIG_FEATURE_VI_OPTIMIZE_CURSOR is not set |
375 | # CONFIG_FEATURE_ALLOW_EXEC is not set | 375 | CONFIG_FEATURE_ALLOW_EXEC=y |
376 | 376 | ||
377 | # | 377 | # |
378 | # Finding Utilities | 378 | # Finding Utilities |
diff --git a/win32/termios.c b/win32/termios.c index 34a17bbfd..390b90382 100644 --- a/win32/termios.c +++ b/win32/termios.c | |||
@@ -10,7 +10,7 @@ int tcgetattr(int fd UNUSED_PARAM, struct termios *t UNUSED_PARAM) | |||
10 | return -1; | 10 | return -1; |
11 | } | 11 | } |
12 | 12 | ||
13 | int64_t FAST_FUNC read_key(int fd, char *buf, int timeout UNUSED_PARAM) | 13 | int64_t FAST_FUNC read_key(int fd, char *buf, int timeout) |
14 | { | 14 | { |
15 | HANDLE cin = GetStdHandle(STD_INPUT_HANDLE); | 15 | HANDLE cin = GetStdHandle(STD_INPUT_HANDLE); |
16 | INPUT_RECORD record; | 16 | INPUT_RECORD record; |
@@ -24,6 +24,10 @@ int64_t FAST_FUNC read_key(int fd, char *buf, int timeout UNUSED_PARAM) | |||
24 | GetConsoleMode(cin, &mode); | 24 | GetConsoleMode(cin, &mode); |
25 | SetConsoleMode(cin, 0); | 25 | SetConsoleMode(cin, 0); |
26 | 26 | ||
27 | if (timeout > 0) { | ||
28 | if (WaitForSingleObject(cin, timeout) != WAIT_OBJECT_0) | ||
29 | goto done; | ||
30 | } | ||
27 | while (1) { | 31 | while (1) { |
28 | if (!ReadConsoleInput(cin, &record, 1, &nevent_out)) | 32 | if (!ReadConsoleInput(cin, &record, 1, &nevent_out)) |
29 | goto done; | 33 | goto done; |