From c845ac8f8da7b4a36139ea07cf92d2390ec043d0 Mon Sep 17 00:00:00 2001 From: Sebastien GODARD Date: Sat, 13 Jun 2020 11:55:28 +0200 Subject: [PATCH] Display statistics in color by default Display statistics in colors by default when the output is connected to a terminal. It is no longer necessary to set the S_COLORS environment variable. Signed-off-by: Sebastien GODARD --- common.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/common.c b/common.c index c086f13..03a1c93 100644 --- a/common.c +++ b/common.c @@ -1061,11 +1061,13 @@ void init_colors(void) int len; /* Read S_COLORS environment variable */ - if (((e = __getenv(ENV_COLORS)) == NULL) || - !strcmp(e, C_NEVER) || - (strcmp(e, C_ALWAYS) && !isatty(STDOUT_FILENO))) { + if ((e = __getenv(ENV_COLORS)) == NULL + ? !isatty(STDOUT_FILENO) + : (!strcmp(e, C_NEVER) || + (strcmp(e, C_ALWAYS) && !isatty(STDOUT_FILENO)))) { /* - * Environment variable not set, or set to "never", + * Environment variable not set and stdout is not a terminal, + * or set to "never", * or set to "auto" and stdout is not a terminal: * Unset color strings. */ -- 2.40.0