about summary refs log tree commit diff
path: root/clients/cli/utils.c
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2016-03-01 16:56:10 +0100
committerMichael Biebl <biebl@debian.org>2016-03-01 16:56:10 +0100
commite62b307a9dd108e664aa507355ed3dd15a9c6d67 (patch)
tree2957d1a0dde11be8bd9f506f8b075d21b85da2d0 /clients/cli/utils.c
parentde39787fedbff438bd933c30675fc5c026db6aa0 (diff)
parentc2de0d98ba39e0a1a970d066fd19be786092f376 (diff)
Merge tag 'upstream/1.1.91'
Upstream version 1.1.91
Diffstat (limited to 'clients/cli/utils.c')
-rw-r--r--clients/cli/utils.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/clients/cli/utils.c b/clients/cli/utils.c
index 898e7f26..d05ea285 100644
--- a/clients/cli/utils.c
+++ b/clients/cli/utils.c
@@ -18,18 +18,17 @@
  */
 
 /* Generated configuration file */
-#include "config.h"
+
+#include "nm-default.h"
 
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
 #include <errno.h>
-
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 
-#include "nm-default.h"
 #include "utils.h"
 
 int
@@ -362,8 +361,13 @@ use_colors (NmCli *nmc)
 	if (nmc == NULL)
 		return FALSE;
 
-	if (nmc->use_colors == NMC_USE_COLOR_AUTO)
-		nmc->use_colors = isatty (fileno (stdout)) ? NMC_USE_COLOR_YES : NMC_USE_COLOR_NO;
+	if (nmc->use_colors == NMC_USE_COLOR_AUTO) {
+		if (   g_strcmp0 (g_getenv ("TERM"), "dumb") == 0
+		    || !isatty (fileno (stdout)))
+			nmc->use_colors = NMC_USE_COLOR_NO;
+		else
+			nmc->use_colors = NMC_USE_COLOR_YES;
+	}
 
 	return nmc->use_colors == NMC_USE_COLOR_YES;
 }