]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
factor: reinstate immediate output with interactive use
authorPádraig Brady <P@draigBrady.com>
Tue, 6 Sep 2016 14:13:32 +0000 (15:13 +0100)
committerPádraig Brady <P@draigBrady.com>
Wed, 7 Sep 2016 09:20:39 +0000 (10:20 +0100)
* src/factor.c (lbuf_putc): Only buffer more than a line
when not using the tool interactively.
* NEWS: Mention the bug fix.
Fixes http://pad.lv/1620139

NEWS
src/factor.c

diff --git a/NEWS b/NEWS
index f4cdf9ecbd512c00b82e088a33f410f58b6011d1..e99c88b962057136e50ce49081939aeac3149f51 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -22,6 +22,9 @@ GNU coreutils NEWS                                    -*- outline -*-
   System V style platforms where this information is available only
   in the global variable 'tzname'. [bug introduced in coreutils-8.24]
 
+  factor again outputs immediately when numbers are input interactively.
+  [bug introduced in coreutils-8.24]
+
   nl now resets numbering for each page section rather than just for each page.
   [This bug was present in "the beginning".]
 
index 8fee75912c94f633a30f0b54065da85dc2331c2f..ff454b4851ca2386f727d1d6e7d674f8d3e11fbc 100644 (file)
@@ -2379,7 +2379,13 @@ lbuf_putc (char c)
     {
       size_t buffered = lbuf.end - lbuf.buf;
 
-      if (buffered >= FACTOR_PIPE_BUF)
+      /* Provide immediate output for interactive input.  */
+      static int line_buffered = -1;
+      if (line_buffered == -1)
+        line_buffered = isatty (STDIN_FILENO);
+      if (line_buffered)
+        lbuf_flush ();
+      else if (buffered >= FACTOR_PIPE_BUF)
         {
           /* Write output in <= PIPE_BUF chunks
              so consumers can read atomically.  */