Jim Meyering <j...@meyering.net> wrote: > Thanks, but as a stand-alone patch, that makes grep fail to compile, > because there is one remaining use of the variable whose declaration > is removed.
Sorry, I fixed it, and compiled and tested. > In any case, there is some ambiguity in the documentation > about what "line" buffering means with -Z. With -l and -Z, should > grep --line-buffered flush after printing each <file_name, NUL> pair? > That's what I'd expect. I interprete the means as line buffered option `_IOLBF' of setvbuf, and I think that many users will expect the behavior. However, different interpretations might also be present.
From 236c4b5f6ba3cbb763c4ae1c92e9a1b087e91ffb Mon Sep 17 00:00:00 2001 From: Norihiro Tanaka <nori...@kcn.ne.jp> Date: Fri, 17 Oct 2014 21:52:29 +0900 Subject: [PATCH] grep: line buffered for output of file names in grep --line-buffered Now grep --line-buffered sets not only matched lines but file names to line buffered. * src/grep.c (static bool line_buffered): Remove var. (prline): Remove it. (main): Remove it, and use setbuf(). --- src/grep.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/grep.c b/src/grep.c index a0f2620..39c0d13 100644 --- a/src/grep.c +++ b/src/grep.c @@ -2409,6 +2409,7 @@ main (int argc, char **argv) case LINE_BUFFERED_OPTION: line_buffered = true; + setvbuf (stdout, NULL, _IOLBF, 0); break; case LABEL_OPTION: -- 2.1.1