summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2014-09-14 01:03:19 -0400
committerPaul Smith <psmith@gnu.org>2014-09-14 01:03:19 -0400
commit7f9ce6e97bd1bb4289477ac76532e156947e7865 (patch)
treeb3e06143fcb0801ff26f203351b5037b5ecbd92f /main.c
parent621e9edfe9ac4ad20ce297787fa308b032b3fa8e (diff)
downloadgunmake-7f9ce6e97bd1bb4289477ac76532e156947e7865.tar.gz
* main.c (main): Set MAKE_TTYOUT and MAKE_TTYERR.
* configure.ac: Test for isatty() and ttyname() * makeint.h: provide a substitute for ttyname() if it's not available. * config.ami.template, config.h-vms.template, config.h.W32.template: define/undefine HAVE_ISATTY/HAVE_TTYNAME macros. * NEWS, doc/make.texi: Document these new variables.
Diffstat (limited to 'main.c')
-rw-r--r--main.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/main.c b/main.c
index 6aecd80..4a79b60 100644
--- a/main.c
+++ b/main.c
@@ -1374,7 +1374,6 @@ main (int argc, char **argv, char **envp)
#endif
/* Decode the switches. */
-
decode_env_switches (STRING_SIZE_TUPLE ("GNUMAKEFLAGS"));
/* Clear GNUMAKEFLAGS to avoid duplication. */
@@ -1398,6 +1397,17 @@ main (int argc, char **argv, char **envp)
decode_switches (argc, (const char **)argv, 0);
+ /* Set a variable specifying whether stdout/stdin is hooked to a TTY. */
+#ifdef HAVE_ISATTY
+ if (isatty (fileno (stdout)))
+ define_variable_cname ("MAKE_TTYOUT", TTYNAME (fileno (stdout)),
+ o_default, 0)->export = v_export;
+
+ if (isatty (fileno (stderr)))
+ define_variable_cname ("MAKE_TTYERR", TTYNAME (fileno (stderr)),
+ o_default, 0)->export = v_export;
+#endif
+
/* Reset in case the switches changed our minds. */
syncing = (output_sync == OUTPUT_SYNC_LINE
|| output_sync == OUTPUT_SYNC_TARGET);