diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2010-04-13 22:05:30 +0200 |
---|---|---|
committer | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2010-04-20 19:14:28 +0200 |
commit | 8922b92d32e69e73292a55e813a37ff857f60a83 (patch) | |
tree | b3219b0c100c3fe11185adec4998065a9278c10f | |
parent | 321324ebf644585cfc3451c5409cb0f55ff03f2e (diff) | |
download | busybox-w32-8922b92d32e69e73292a55e813a37ff857f60a83.tar.gz busybox-w32-8922b92d32e69e73292a55e813a37ff857f60a83.tar.bz2 busybox-w32-8922b92d32e69e73292a55e813a37ff857f60a83.zip |
win32: Config.in: CYGWIN
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
-rw-r--r-- | editors/vi.c | 27 | ||||
-rw-r--r-- | libbb/Config.in | 1 |
2 files changed, 28 insertions, 0 deletions
diff --git a/editors/vi.c b/editors/vi.c index 28612508f..238d42b9c 100644 --- a/editors/vi.c +++ b/editors/vi.c | |||
@@ -23,6 +23,10 @@ | |||
23 | 23 | ||
24 | #include "libbb.h" | 24 | #include "libbb.h" |
25 | 25 | ||
26 | #ifdef __MINGW32__ | ||
27 | #include "cygwin_termios.h" | ||
28 | #endif | ||
29 | |||
26 | /* the CRASHME code is unmaintained, and doesn't currently build */ | 30 | /* the CRASHME code is unmaintained, and doesn't currently build */ |
27 | #define ENABLE_FEATURE_VI_CRASHME 0 | 31 | #define ENABLE_FEATURE_VI_CRASHME 0 |
28 | 32 | ||
@@ -2200,6 +2204,27 @@ static void catch_sig(int sig) | |||
2200 | } | 2204 | } |
2201 | #endif /* FEATURE_VI_USE_SIGNALS */ | 2205 | #endif /* FEATURE_VI_USE_SIGNALS */ |
2202 | 2206 | ||
2207 | #ifdef __MINGW32__ | ||
2208 | static int mysleep(int hund) // sleep for 'h' 1/100 seconds | ||
2209 | { | ||
2210 | HANDLE h = GetStdHandle(STD_INPUT_HANDLE); | ||
2211 | |||
2212 | fflush(stdout); | ||
2213 | |||
2214 | /* In case of cygwin, it's a named pipe and won't work with WaitForSingleObject */ | ||
2215 | if (is_cygwin_tty(0) || !h) { | ||
2216 | if (hund) | ||
2217 | Sleep(hund*10); | ||
2218 | return 0; | ||
2219 | } | ||
2220 | else { | ||
2221 | DWORD ret; | ||
2222 | |||
2223 | ret = WaitForSingleObject(h, hund*10); | ||
2224 | return ret != WAIT_TIMEOUT; | ||
2225 | } | ||
2226 | } | ||
2227 | #else | ||
2203 | static int mysleep(int hund) // sleep for 'hund' 1/100 seconds or stdin ready | 2228 | static int mysleep(int hund) // sleep for 'hund' 1/100 seconds or stdin ready |
2204 | { | 2229 | { |
2205 | struct pollfd pfd[1]; | 2230 | struct pollfd pfd[1]; |
@@ -2208,6 +2233,8 @@ static int mysleep(int hund) // sleep for 'hund' 1/100 seconds or stdin ready | |||
2208 | pfd[0].events = POLLIN; | 2233 | pfd[0].events = POLLIN; |
2209 | return safe_poll(pfd, 1, hund*10) > 0; | 2234 | return safe_poll(pfd, 1, hund*10) > 0; |
2210 | } | 2235 | } |
2236 | #endif | ||
2237 | |||
2211 | 2238 | ||
2212 | //----- IO Routines -------------------------------------------- | 2239 | //----- IO Routines -------------------------------------------- |
2213 | static int readit(void) // read (maybe cursor) key from stdin | 2240 | static int readit(void) // read (maybe cursor) key from stdin |
diff --git a/libbb/Config.in b/libbb/Config.in index 7a2d922ed..c255693d8 100644 --- a/libbb/Config.in +++ b/libbb/Config.in | |||
@@ -55,6 +55,7 @@ config FEATURE_CYGWIN_TTY | |||
55 | config FEATURE_EDITING | 55 | config FEATURE_EDITING |
56 | bool "Command line editing" | 56 | bool "Command line editing" |
57 | default n | 57 | default n |
58 | depends on FEATURE_CYGWIN_TTY | ||
58 | help | 59 | help |
59 | Enable line editing (mainly for shell command line). | 60 | Enable line editing (mainly for shell command line). |
60 | 61 | ||