[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] factor: reinstate immediate output with interactive use
From: |
Pádraig Brady |
Subject: |
[PATCH] factor: reinstate immediate output with interactive use |
Date: |
Tue, 6 Sep 2016 15:35:29 +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 | 3 +++
src/factor.c | 8 +++++++-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/NEWS b/NEWS
index 34a969e..a699010 100644
--- 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".]
diff --git a/src/factor.c b/src/factor.c
index 8fee759..c648a1d 100644
--- a/src/factor.c
+++ b/src/factor.c
@@ -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. */
--
2.5.5
- [PATCH] factor: reinstate immediate output with interactive use,
Pádraig Brady <=