From c3ec282f95b5b1f0efe18fe7030c4a9c7486db00 Mon Sep 17 00:00:00 2001 From: Norihiro Tanaka 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 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/grep.c b/src/grep.c index a0f2620..64a5fa5 100644 --- a/src/grep.c +++ b/src/grep.c @@ -835,7 +835,6 @@ static int list_files; /* List matching files. */ static bool no_filenames; /* Suppress file names. */ static intmax_t max_count; /* Stop after outputting this many lines from an input file. */ -static bool line_buffered; /* Use line buffering. */ static char *label = NULL; /* Fake filename for stdin */ @@ -2408,7 +2407,7 @@ main (int argc, char **argv) break; case LINE_BUFFERED_OPTION: - line_buffered = true; + setvbuf (stdout, NULL, _IOLBF, 0); break; case LABEL_OPTION: -- 2.1.1