diff options
-rw-r--r-- | win32/winansi.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/win32/winansi.c b/win32/winansi.c index d8acb56d5..622ba1c77 100644 --- a/win32/winansi.c +++ b/win32/winansi.c | |||
@@ -4,6 +4,7 @@ | |||
4 | 4 | ||
5 | #include "libbb.h" | 5 | #include "libbb.h" |
6 | #include <windows.h> | 6 | #include <windows.h> |
7 | #include "lazyload.h" | ||
7 | #undef PACKED | 8 | #undef PACKED |
8 | 9 | ||
9 | /* | 10 | /* |
@@ -55,6 +56,13 @@ static int is_console_in(int fd) | |||
55 | return isatty(fd) && GetStdHandle(STD_INPUT_HANDLE) != INVALID_HANDLE_VALUE; | 56 | return isatty(fd) && GetStdHandle(STD_INPUT_HANDLE) != INVALID_HANDLE_VALUE; |
56 | } | 57 | } |
57 | 58 | ||
59 | static int is_wine(void) | ||
60 | { | ||
61 | DECLARE_PROC_ADDR(const char *, wine_get_version, void); | ||
62 | |||
63 | return INIT_PROC_ADDR(ntdll.dll, wine_get_version) != NULL; | ||
64 | } | ||
65 | |||
58 | #ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING | 66 | #ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING |
59 | #define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004 | 67 | #define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004 |
60 | #endif | 68 | #endif |
@@ -69,7 +77,8 @@ int skip_ansi_emulation(int reset) | |||
69 | 77 | ||
70 | if (skip < 0 || reset) { | 78 | if (skip < 0 || reset) { |
71 | const char *var = getenv(bb_skip_ansi_emulation); | 79 | const char *var = getenv(bb_skip_ansi_emulation); |
72 | skip = var == NULL ? CONFIG_SKIP_ANSI_EMULATION_DEFAULT : atoi(var); | 80 | int dflt = is_wine() ? 0 : CONFIG_SKIP_ANSI_EMULATION_DEFAULT; |
81 | skip = var == NULL ? dflt : atoi(var); | ||
73 | if (skip < 0 || skip > 2) | 82 | if (skip < 0 || skip > 2) |
74 | skip = 0; | 83 | skip = 0; |
75 | 84 | ||
@@ -115,7 +124,7 @@ static void use_alt_buffer(int flag) | |||
115 | HANDLE console, h; | 124 | HANDLE console, h; |
116 | 125 | ||
117 | var = getenv("BB_ALT_BUFFER"); | 126 | var = getenv("BB_ALT_BUFFER"); |
118 | if (var && strcmp(var, "0") == 0) { | 127 | if (var ? strcmp(var, "0") == 0 : is_wine()) { |
119 | reset_screen(); | 128 | reset_screen(); |
120 | return; | 129 | return; |
121 | } | 130 | } |