diff options
author | Ron Yorston <rmy@pobox.com> | 2023-02-19 13:15:44 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2023-02-19 13:15:44 +0000 |
commit | 2014a9685633bb48bfcd4363d8d883055ef8b68b (patch) | |
tree | 3eebdf166c137d61cdd43aac1fa580420d36a087 | |
parent | eefae06bd0dc1e10c166155afab4b115439bc802 (diff) | |
download | busybox-w32-2014a9685633bb48bfcd4363d8d883055ef8b68b.tar.gz busybox-w32-2014a9685633bb48bfcd4363d8d883055ef8b68b.tar.bz2 busybox-w32-2014a9685633bb48bfcd4363d8d883055ef8b68b.zip |
win32: shuffle skip_ansi_emulation() code
Rearrange code to avoid unnecessary tests when the environment
variable BB_SKIP_ANSI_EMULATION is set.
-rw-r--r-- | win32/winansi.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/win32/winansi.c b/win32/winansi.c index 1400ea3bb..15f443f4b 100644 --- a/win32/winansi.c +++ b/win32/winansi.c | |||
@@ -77,12 +77,14 @@ int skip_ansi_emulation(int reset) | |||
77 | 77 | ||
78 | if (skip < 0 || reset) { | 78 | if (skip < 0 || reset) { |
79 | const char *var = getenv(BB_SKIP_ANSI_EMULATION); | 79 | const char *var = getenv(BB_SKIP_ANSI_EMULATION); |
80 | int dflt = CONFIG_SKIP_ANSI_EMULATION_DEFAULT; | 80 | if (var) { |
81 | if (is_wine() || getenv("CONEMUPID") != NULL) | 81 | skip = atoi(var); |
82 | dflt = 0; | 82 | if (skip < 0 || skip > 2) |
83 | skip = var == NULL ? dflt : atoi(var); | 83 | skip = 0; |
84 | if (skip < 0 || skip > 2) | 84 | } else { |
85 | skip = 0; | 85 | skip = (getenv("CONEMUPID") != NULL || is_wine()) ? 0 : |
86 | CONFIG_SKIP_ANSI_EMULATION_DEFAULT; | ||
87 | } | ||
86 | 88 | ||
87 | if (is_console(STDOUT_FILENO)) { | 89 | if (is_console(STDOUT_FILENO)) { |
88 | HANDLE h = get_console(); | 90 | HANDLE h = get_console(); |