From ab7a10870d7347056d86eed03f6aca62aaf4d083 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Wed, 3 Feb 2021 13:46:19 +0000 Subject: winansi: change default 'skip ANSI emulation' setting Change the default 'skip ANSI emulation' setting which is used when the environment variable BB_SKIP_ANSI_EMULATION is unset. Previously it was 0 (always emulate) now it's 2 (detect whether or not the terminal supports ANSI escape sequences and behave accordingly). The default value is also now a build-time option. --- win32/winansi.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'win32') diff --git a/win32/winansi.c b/win32/winansi.c index 3767e7534..59292efc3 100644 --- a/win32/winansi.c +++ b/win32/winansi.c @@ -68,19 +68,9 @@ int skip_ansi_emulation(int reset) if (skip < 0 || reset) { const char *var = getenv(bb_skip_ansi_emulation); - skip = var != NULL; - if (skip) { - switch (xatou(var)) { - case 1: - break; - case 2: - skip = 2; - break; - default: - skip = 0; - break; - } - } + skip = var == NULL ? CONFIG_SKIP_ANSI_EMULATION_DEFAULT : atoi(var); + if (skip < 0 || skip > 2) + skip = 0; if (is_console(STDOUT_FILENO)) { HANDLE h = get_console(); -- cgit v1.2.3-55-g6feb