diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2010-09-21 18:26:46 +1000 |
---|---|---|
committer | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2010-09-21 18:26:46 +1000 |
commit | 4a94af55a106bd84bd72be6700f813411eb7dd48 (patch) | |
tree | d5f137d3d858d7fdd0cb4bab308025be62ef449d | |
parent | 7a30dffb59673ef5b5e1ff30248d2e72d6814fd5 (diff) | |
download | busybox-w32-4a94af55a106bd84bd72be6700f813411eb7dd48.tar.gz busybox-w32-4a94af55a106bd84bd72be6700f813411eb7dd48.tar.bz2 busybox-w32-4a94af55a106bd84bd72be6700f813411eb7dd48.zip |
win32: lineedit: fallback to fgets if a tty is not found
-rw-r--r-- | libbb/lineedit.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libbb/lineedit.c b/libbb/lineedit.c index 3af9f4e64..1b88a7141 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c | |||
@@ -1914,10 +1914,13 @@ int FAST_FUNC read_line_input(const char *prompt, char *command, int maxsize, li | |||
1914 | 1914 | ||
1915 | INIT_S(); | 1915 | INIT_S(); |
1916 | 1916 | ||
1917 | #if !ENABLE_PLATFORM_MINGW32 | 1917 | #if ENABLE_PLATFORM_MINGW32 |
1918 | if (!isatty(0) || !isatty(1)) { | ||
1919 | #else | ||
1918 | if (tcgetattr(STDIN_FILENO, &initial_settings) < 0 | 1920 | if (tcgetattr(STDIN_FILENO, &initial_settings) < 0 |
1919 | || !(initial_settings.c_lflag & ECHO) | 1921 | || !(initial_settings.c_lflag & ECHO) |
1920 | ) { | 1922 | ) { |
1923 | #endif | ||
1921 | /* Happens when e.g. stty -echo was run before */ | 1924 | /* Happens when e.g. stty -echo was run before */ |
1922 | parse_and_put_prompt(prompt); | 1925 | parse_and_put_prompt(prompt); |
1923 | /* fflush_all(); - done by parse_and_put_prompt */ | 1926 | /* fflush_all(); - done by parse_and_put_prompt */ |
@@ -1928,7 +1931,6 @@ int FAST_FUNC read_line_input(const char *prompt, char *command, int maxsize, li | |||
1928 | DEINIT_S(); | 1931 | DEINIT_S(); |
1929 | return len; | 1932 | return len; |
1930 | } | 1933 | } |
1931 | #endif | ||
1932 | 1934 | ||
1933 | init_unicode(); | 1935 | init_unicode(); |
1934 | 1936 | ||