[cowdancer] 01/03: Check TERM rather than isatty, like tput
James Clarke
jrtc27-guest at moszumanska.debian.org
Mon Sep 12 21:30:11 UTC 2016
This is an automated email from the git hooks/post-receive script.
jrtc27-guest pushed a commit to branch master
in repository cowdancer.
commit af0c74ab6b05cc2f2f019c55ae47cddeecc79a86
Author: James Clarke <jrtc27 at jrtc27.com>
Date: Mon Sep 12 19:28:28 2016 +0100
Check TERM rather than isatty, like tput
---
log.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/log.c b/log.c
index a132af0..f3b0c62 100644
--- a/log.c
+++ b/log.c
@@ -24,6 +24,7 @@
#include <errno.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@@ -47,13 +48,16 @@ static int term_supports_colors(void)
int colors;
int erret;
+ const char *term;
- if (!isatty(STDOUT_FILENO))
+ term = getenv("TERM");
+
+ if (!term || !*term)
return 0;
if (!called_setupterm)
{
- if (setupterm(NULL, STDOUT_FILENO, &erret) != OK && erret <= 0)
+ if (setupterm(term, STDOUT_FILENO, &erret) != OK && erret <= 0)
{
fprintf(stderr, "E: Error calling setupterm: %d\n", erret);
return 0;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pbuilder/cowdancer.git
More information about the Pbuilder-maint
mailing list