From patchwork Sun Feb 2 21:15:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 17664 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 72CD744BAC7 for ; Sun, 2 Feb 2020 23:15:50 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4773E688117; Sun, 2 Feb 2020 23:15:50 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B39DE687F29 for ; Sun, 2 Feb 2020 23:15:44 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 995E1E3DCA; Sun, 2 Feb 2020 22:15:44 +0100 (CET) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QekLhX0lo7JV; Sun, 2 Feb 2020 22:15:42 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 98199E3445; Sun, 2 Feb 2020 22:15:42 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Sun, 2 Feb 2020 22:15:30 +0100 Message-Id: <20200202211534.12739-1-cus@passwd.hu> X-Mailer: git-send-email 2.16.4 Subject: [FFmpeg-devel] [PATCH 1/5] avutil/log: drop support for NO_COLOR environment variable X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Marton Balint MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Deprecated for more than 9 years now. Signed-off-by: Marton Balint --- doc/fftools-common-opts.texi | 4 +--- libavutil/log.c | 8 +++----- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/doc/fftools-common-opts.texi b/doc/fftools-common-opts.texi index 31cf424823..f339e0d766 100644 --- a/doc/fftools-common-opts.texi +++ b/doc/fftools-common-opts.texi @@ -236,10 +236,8 @@ ffmpeg [...] -loglevel +repeat By default the program logs to stderr. If coloring is supported by the terminal, colors are used to mark errors and warnings. Log coloring can be disabled setting the environment variable -@env{AV_LOG_FORCE_NOCOLOR} or @env{NO_COLOR}, or can be forced setting +@env{AV_LOG_FORCE_NOCOLOR}, or can be forced setting the environment variable @env{AV_LOG_FORCE_COLOR}. -The use of the environment variable @env{NO_COLOR} is deprecated and -will be dropped in a future FFmpeg version. @item -report Dump full command line and log output to a file named diff --git a/libavutil/log.c b/libavutil/log.c index 0a7b169bc0..6d87c718a8 100644 --- a/libavutil/log.c +++ b/libavutil/log.c @@ -125,8 +125,7 @@ static void check_color_terminal(void) #if defined(_WIN32) && HAVE_SETCONSOLETEXTATTRIBUTE && HAVE_GETSTDHANDLE CONSOLE_SCREEN_BUFFER_INFO con_info; con = GetStdHandle(STD_ERROR_HANDLE); - use_color = (con != INVALID_HANDLE_VALUE) && !getenv("NO_COLOR") && - !getenv("AV_LOG_FORCE_NOCOLOR"); + use_color = (con != INVALID_HANDLE_VALUE) && !getenv("AV_LOG_FORCE_NOCOLOR"); if (use_color) { GetConsoleScreenBufferInfo(con, &con_info); attr_orig = con_info.wAttributes; @@ -134,14 +133,13 @@ static void check_color_terminal(void) } #elif HAVE_ISATTY char *term = getenv("TERM"); - use_color = !getenv("NO_COLOR") && !getenv("AV_LOG_FORCE_NOCOLOR") && + use_color = !getenv("AV_LOG_FORCE_NOCOLOR") && (getenv("TERM") && isatty(2) || getenv("AV_LOG_FORCE_COLOR")); if ( getenv("AV_LOG_FORCE_256COLOR") || (term && strstr(term, "256color"))) use_color *= 256; #else - use_color = getenv("AV_LOG_FORCE_COLOR") && !getenv("NO_COLOR") && - !getenv("AV_LOG_FORCE_NOCOLOR"); + use_color = getenv("AV_LOG_FORCE_COLOR") && !getenv("AV_LOG_FORCE_NOCOLOR"); #endif } From patchwork Sun Feb 2 21:15:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 17665 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 90ADF44BAC7 for ; Sun, 2 Feb 2020 23:15:53 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7D5A76881A5; Sun, 2 Feb 2020 23:15:53 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 37862687FBA for ; Sun, 2 Feb 2020 23:15:47 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 2689AE3DE7; Sun, 2 Feb 2020 22:15:47 +0100 (CET) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id u7BIcy6UbQKC; Sun, 2 Feb 2020 22:15:45 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 2F147E3445; Sun, 2 Feb 2020 22:15:45 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Sun, 2 Feb 2020 22:15:31 +0100 Message-Id: <20200202211534.12739-2-cus@passwd.hu> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20200202211534.12739-1-cus@passwd.hu> References: <20200202211534.12739-1-cus@passwd.hu> Subject: [FFmpeg-devel] [PATCH 2/5] avutil/log: factorize ansi_fputs X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Marton Balint MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Marton Balint --- libavutil/log.c | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/libavutil/log.c b/libavutil/log.c index 6d87c718a8..64950016e8 100644 --- a/libavutil/log.c +++ b/libavutil/log.c @@ -143,25 +143,8 @@ static void check_color_terminal(void) #endif } -static void colored_fputs(int level, int tint, const char *str) +static void ansi_fputs(int level, int tint, const char *str, int local_use_color) { - int local_use_color; - if (!*str) - return; - - if (use_color < 0) - check_color_terminal(); - - if (level == AV_LOG_INFO/8) local_use_color = 0; - else local_use_color = use_color; - -#if defined(_WIN32) && HAVE_SETCONSOLETEXTATTRIBUTE && HAVE_GETSTDHANDLE - if (local_use_color) - SetConsoleTextAttribute(con, background | color[level]); - fputs(str, stderr); - if (local_use_color) - SetConsoleTextAttribute(con, attr_orig); -#else if (local_use_color == 1) { fprintf(stderr, "\033[%"PRIu32";3%"PRIu32"m%s\033[0m", @@ -182,6 +165,28 @@ static void colored_fputs(int level, int tint, const char *str) str); } else fputs(str, stderr); +} + +static void colored_fputs(int level, int tint, const char *str) +{ + int local_use_color; + if (!*str) + return; + + if (use_color < 0) + check_color_terminal(); + + if (level == AV_LOG_INFO/8) local_use_color = 0; + else local_use_color = use_color; + +#if defined(_WIN32) && HAVE_SETCONSOLETEXTATTRIBUTE && HAVE_GETSTDHANDLE + if (local_use_color) + SetConsoleTextAttribute(con, background | color[level]); + fputs(str, stderr); + if (local_use_color) + SetConsoleTextAttribute(con, attr_orig); +#else + ansi_fputs(level, tint, str, local_use_color); #endif } From patchwork Sun Feb 2 21:15:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 17666 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 7EA6644BAC7 for ; Sun, 2 Feb 2020 23:15:55 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 67AE46882F4; Sun, 2 Feb 2020 23:15:55 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B92526882D6 for ; Sun, 2 Feb 2020 23:15:49 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id DF758E3DE9; Sun, 2 Feb 2020 22:15:48 +0100 (CET) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dRBZe_B9y2Vp; Sun, 2 Feb 2020 22:15:47 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 0FD51E3DE6; Sun, 2 Feb 2020 22:15:47 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Sun, 2 Feb 2020 22:15:32 +0100 Message-Id: <20200202211534.12739-3-cus@passwd.hu> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20200202211534.12739-1-cus@passwd.hu> References: <20200202211534.12739-1-cus@passwd.hu> Subject: [FFmpeg-devel] [PATCH 3/5] avutil/log: fix detecting console mode on Win32 X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Marton Balint MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" A redirected stderr can still have a valid handle. Signed-off-by: Marton Balint --- libavutil/log.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavutil/log.c b/libavutil/log.c index 64950016e8..6374050770 100644 --- a/libavutil/log.c +++ b/libavutil/log.c @@ -124,7 +124,10 @@ static void check_color_terminal(void) { #if defined(_WIN32) && HAVE_SETCONSOLETEXTATTRIBUTE && HAVE_GETSTDHANDLE CONSOLE_SCREEN_BUFFER_INFO con_info; + DWORD dummy; con = GetStdHandle(STD_ERROR_HANDLE); + if (con != INVALID_HANDLE_VALUE && !GetConsoleMode(con, &dummy)) + con = INVALID_HANDLE_VALUE; use_color = (con != INVALID_HANDLE_VALUE) && !getenv("AV_LOG_FORCE_NOCOLOR"); if (use_color) { GetConsoleScreenBufferInfo(con, &con_info); From patchwork Sun Feb 2 21:15:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 17667 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 299EB44BAC7 for ; Sun, 2 Feb 2020 23:15:58 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1334C689244; Sun, 2 Feb 2020 23:15:58 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 881656882B8 for ; Sun, 2 Feb 2020 23:15:51 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 6A108E3445; Sun, 2 Feb 2020 22:15:51 +0100 (CET) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6oaJTEcKuSZG; Sun, 2 Feb 2020 22:15:49 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 93B7FE3DF3; Sun, 2 Feb 2020 22:15:48 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Sun, 2 Feb 2020 22:15:33 +0100 Message-Id: <20200202211534.12739-4-cus@passwd.hu> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20200202211534.12739-1-cus@passwd.hu> References: <20200202211534.12739-1-cus@passwd.hu> Subject: [FFmpeg-devel] [PATCH 4/5] avutil/log: add support for forced ANSI colors on win32 X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Marton Balint MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" To make behavior the same as non-win32 code when the standard error is redirected. Also restructure the code a bit. Signed-off-by: Marton Balint --- libavutil/log.c | 41 +++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/libavutil/log.c b/libavutil/log.c index 6374050770..213594c2a5 100644 --- a/libavutil/log.c +++ b/libavutil/log.c @@ -122,28 +122,37 @@ static int use_color = -1; static void check_color_terminal(void) { + char *term = getenv("TERM"); + #if defined(_WIN32) && HAVE_SETCONSOLETEXTATTRIBUTE && HAVE_GETSTDHANDLE CONSOLE_SCREEN_BUFFER_INFO con_info; DWORD dummy; con = GetStdHandle(STD_ERROR_HANDLE); if (con != INVALID_HANDLE_VALUE && !GetConsoleMode(con, &dummy)) con = INVALID_HANDLE_VALUE; - use_color = (con != INVALID_HANDLE_VALUE) && !getenv("AV_LOG_FORCE_NOCOLOR"); - if (use_color) { + if (con != INVALID_HANDLE_VALUE) { GetConsoleScreenBufferInfo(con, &con_info); attr_orig = con_info.wAttributes; background = attr_orig & 0xF0; } +#endif + + if (getenv("AV_LOG_FORCE_NOCOLOR")) { + use_color = 0; + } else if (getenv("AV_LOG_FORCE_COLOR")) { + use_color = 1; + } else { +#if defined(_WIN32) && HAVE_SETCONSOLETEXTATTRIBUTE && HAVE_GETSTDHANDLE + use_color = (con != INVALID_HANDLE_VALUE); #elif HAVE_ISATTY - char *term = getenv("TERM"); - use_color = !getenv("AV_LOG_FORCE_NOCOLOR") && - (getenv("TERM") && isatty(2) || getenv("AV_LOG_FORCE_COLOR")); - if ( getenv("AV_LOG_FORCE_256COLOR") - || (term && strstr(term, "256color"))) - use_color *= 256; + use_color = (term && isatty(2)); #else - use_color = getenv("AV_LOG_FORCE_COLOR") && !getenv("AV_LOG_FORCE_NOCOLOR"); + use_color = 0; #endif + } + + if (getenv("AV_LOG_FORCE_256COLOR") || term && strstr(term, "256color")) + use_color *= 256; } static void ansi_fputs(int level, int tint, const char *str, int local_use_color) @@ -183,11 +192,15 @@ static void colored_fputs(int level, int tint, const char *str) else local_use_color = use_color; #if defined(_WIN32) && HAVE_SETCONSOLETEXTATTRIBUTE && HAVE_GETSTDHANDLE - if (local_use_color) - SetConsoleTextAttribute(con, background | color[level]); - fputs(str, stderr); - if (local_use_color) - SetConsoleTextAttribute(con, attr_orig); + if (con != INVALID_HANDLE_VALUE) { + if (local_use_color) + SetConsoleTextAttribute(con, background | color[level]); + fputs(str, stderr); + if (local_use_color) + SetConsoleTextAttribute(con, attr_orig); + } else { + ansi_fputs(level, tint, str, local_use_color); + } #else ansi_fputs(level, tint, str, local_use_color); #endif From patchwork Sun Feb 2 21:15:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 17668 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 3BF2F44BAC7 for ; Sun, 2 Feb 2020 23:16:00 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 23BA6689884; Sun, 2 Feb 2020 23:16:00 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D42686891EF for ; Sun, 2 Feb 2020 23:15:53 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id B7A2EE3446; Sun, 2 Feb 2020 22:15:53 +0100 (CET) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ruIz3ThA5Cn8; Sun, 2 Feb 2020 22:15:52 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 7AE65E3DF2; Sun, 2 Feb 2020 22:15:51 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Sun, 2 Feb 2020 22:15:34 +0100 Message-Id: <20200202211534.12739-5-cus@passwd.hu> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20200202211534.12739-1-cus@passwd.hu> References: <20200202211534.12739-1-cus@passwd.hu> Subject: [FFmpeg-devel] [PATCH 5/5] avutil/log: add support for multibyte console log for win32 X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Marton Balint MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Fixes ticket #5398. Signed-off-by: Marton Balint --- libavutil/log.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/libavutil/log.c b/libavutil/log.c index 213594c2a5..78e703b9e9 100644 --- a/libavutil/log.c +++ b/libavutil/log.c @@ -120,6 +120,31 @@ static const uint32_t color[16 + AV_CLASS_CATEGORY_NB] = { #endif static int use_color = -1; +#if defined(_WIN32) && HAVE_SETCONSOLETEXTATTRIBUTE && HAVE_GETSTDHANDLE +static void win_console_puts(const char *str) +{ + const uint8_t *q = str; + uint16_t line[LINE_SZ]; + + while (*q) { + uint16_t *buf = line; + DWORD nb_chars = 0; + DWORD written; + + while (*q && nb_chars < LINE_SZ - 1) { + uint32_t ch; + uint16_t tmp; + + GET_UTF8(ch, *q ? *q++ : 0, ch = 0xfffd; goto continue_on_invalid;) +continue_on_invalid: + PUT_UTF16(ch, tmp, *buf++ = tmp; nb_chars++;) + } + + WriteConsoleW(con, line, nb_chars, &written, NULL); + } +} +#endif + static void check_color_terminal(void) { char *term = getenv("TERM"); @@ -195,7 +220,7 @@ static void colored_fputs(int level, int tint, const char *str) if (con != INVALID_HANDLE_VALUE) { if (local_use_color) SetConsoleTextAttribute(con, background | color[level]); - fputs(str, stderr); + win_console_puts(str); if (local_use_color) SetConsoleTextAttribute(con, attr_orig); } else {