m4-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Interactive behaviour


From: Stepan Kasal
Subject: Interactive behaviour
Date: Wed, 20 Sep 2006 13:21:08 +0200
User-agent: Mutt/1.4.2.1i

Hello,
  current CVS version of m4 sets interactive mode iff the stdin is a
tty.  I think it would be better to set interactive mode iff the
stdin, the stdout, and the stderr are a tty.  (Something like the
patch below.)

Background: autom4te currently calls "m4 </dev/null" to ensure
non-interactive mode for both m4-1.4 and m4-2.0.
To teach autom4te to handle stdin correctly, I would like to remove
the redirection.
I mailed about that to m4-discuss, and the above proposal is a
variation of what Gary proposed there:
http://lists.gnu.org/archive/html/m4-discuss/2006-04/threads.html
(Yes, autom4te could make use of the option `-b', testing first
whether it is available, yet I would prefer the above solution.)

Wdyt about this?

Stepan Kasal


Index: src/main.c
===================================================================
RCS file: /cvsroot/m4/m4/src/main.c,v
retrieving revision 1.85
diff -u -r1.85 main.c
--- src/main.c  20 Sep 2006 04:04:29 -0000      1.85
+++ src/main.c  20 Sep 2006 11:13:54 -0000
@@ -263,7 +263,7 @@
   setup_stackovf_trap (argv, envp, stackovf_handler);
 #endif
 
-  if (isatty (STDIN_FILENO))
+  if (isatty (STDIN_FILENO) && isatty (STDOUT_FILENO) && isatty 
(STDERR_FILENO))
     m4_set_interactive_opt (context, true);
 
   if (getenv ("POSIXLY_CORRECT"))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]