5 bool use_ansi_escapes(FILE *out) {
6 bool is_tty = isatty(fileno(out));
9 const char *term = getenv("TERM");
10 return is_tty && term && strcmp(term, "dumb");
15 console = GetStdHandle(STD_OUTPUT_HANDLE);
16 } else if(out == stderr) {
17 console = GetStdHandle(STD_ERROR_HANDLE);
24 console != INVALID_HANDLE_VALUE &&
25 GetConsoleMode(console, &mode) &&
26 SetConsoleMode(console, mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING);