Module Name: src Committed By: christos Date: Sat Aug 11 19:44:19 UTC 2018
Modified Files: src/usr.bin/grep: grep.c Log Message: use setvbuf if available; it is more portable. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/usr.bin/grep/grep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/grep/grep.c diff -u src/usr.bin/grep/grep.c:1.12 src/usr.bin/grep/grep.c:1.13 --- src/usr.bin/grep/grep.c:1.12 Fri Jul 11 12:30:45 2014 +++ src/usr.bin/grep/grep.c Sat Aug 11 15:44:19 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: grep.c,v 1.12 2014/07/11 16:30:45 christos Exp $ */ +/* $NetBSD: grep.c,v 1.13 2018/08/11 19:44:19 christos Exp $ */ /* $FreeBSD: head/usr.bin/grep/grep.c 211519 2010-08-19 22:55:17Z delphij $ */ /* $OpenBSD: grep.c,v 1.42 2010/07/02 22:18:03 tedu Exp $ */ @@ -34,7 +34,7 @@ #endif #include <sys/cdefs.h> -__RCSID("$NetBSD: grep.c,v 1.12 2014/07/11 16:30:45 christos Exp $"); +__RCSID("$NetBSD: grep.c,v 1.13 2018/08/11 19:44:19 christos Exp $"); #include <sys/stat.h> #include <sys/types.h> @@ -679,8 +679,13 @@ main(int argc, char *argv[]) } } - if (lbflag) + if (lbflag) { +#ifdef _IOLBF + setvbuf(stdout, NULL, _IOLBF, 0); +#else setlinebuf(stdout); +#endif + } if ((aargc == 0 || aargc == 1) && !Hflag) hflag = true;