$ echo '1errprint(2)3' | m4 2>&1
213

Yuck - we interleaved output to /dev/tty (although Solaris has the same bug).  
It is much nicer to flush all pending stdout before printing to stderr (at 
least, the gnulib error module thinks so), in case the two FILEs point to the 
same underlying file:

$ echo '1errprint(2)3' | src/m4 2>&1
123

2006-08-16  Eric Blake  <[EMAIL PROTECTED]>

        * src/builtin.c (m4_errprint): Flush buffers before printing to
        stderr.

Index: src/builtin.c
===================================================================
RCS file: /sources/m4/m4/src/Attic/builtin.c,v
retrieving revision 1.1.1.1.2.32
diff -u -r1.1.1.1.2.32 builtin.c
--- src/builtin.c       15 Aug 2006 13:51:47 -0000      1.1.1.1.2.32
+++ src/builtin.c       16 Aug 2006 14:23:29 -0000
@@ -1231,6 +1231,7 @@
     return;
   dump_args (obs, argc, argv, " ", FALSE);
   obstack_1grow (obs, '\0');
+  debug_flush_files ();
   fprintf (stderr, "%s", (char *) obstack_finish (obs));
   fflush (stderr);
 }





_______________________________________________
M4-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/m4-patches

Reply via email to