m4-patches
[Top][All Lists]
Advanced

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

branch-1_4 output flushing


From: Eric Blake
Subject: branch-1_4 output flushing
Date: Wed, 16 Aug 2006 14:28:53 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

$ 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  <address@hidden>

        * 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);
 }







reply via email to

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