aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--win32/winansi.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/win32/winansi.c b/win32/winansi.c
index 7069b8d80..e95b9c846 100644
--- a/win32/winansi.c
+++ b/win32/winansi.c
@@ -59,6 +59,19 @@ static void init(void)
59 initialized = 1; 59 initialized = 1;
60} 60}
61 61
62static int skip_ansi_emulation(void)
63{
64 static char *var = NULL;
65 static int got_var = FALSE;
66
67 if (!got_var) {
68 var = getenv("BB_SKIP_ANSI_EMULATION");
69 got_var = TRUE;
70 }
71
72 return var != NULL;
73}
74
62 75
63#define FOREGROUND_ALL (FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE) 76#define FOREGROUND_ALL (FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE)
64#define BACKGROUND_ALL (BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE) 77#define BACKGROUND_ALL (BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE)
@@ -399,7 +412,7 @@ static int ansi_emulate(const char *s, FILE *stream)
399 412
400 while (*pos) { 413 while (*pos) {
401 pos = strstr(str, "\033["); 414 pos = strstr(str, "\033[");
402 if (pos) { 415 if (pos && !skip_ansi_emulation()) {
403 size_t len = pos - str; 416 size_t len = pos - str;
404 417
405 if (len) { 418 if (len) {
@@ -636,7 +649,7 @@ static int ansi_emulate_write(int fd, const void *buf, size_t count)
636 /* we've checked the data doesn't contain any NULs */ 649 /* we've checked the data doesn't contain any NULs */
637 while (*pos) { 650 while (*pos) {
638 pos = strstr(str, "\033["); 651 pos = strstr(str, "\033[");
639 if (pos) { 652 if (pos && !skip_ansi_emulation()) {
640 len = pos - str; 653 len = pos - str;
641 654
642 if (len) { 655 if (len) {