git: 9front

Download patch

ref: 8473218f50acee069c5b4c08c5e31e91d30d9c0b
parent: 77c566ef9abe8df441f7c6a5e53626f0e7cb22fa
author: Alex Musolino <alex@musolino.id.au>
date: Thu Mar 26 14:24:39 EDT 2020

grep: fix handling of -b flag

Output buffering is automatically disabled when reading from stdin.
In this case, supplying the -b flag ought to be redundant.  However,
since Bflag was being XORed into the flag set - rather than simply
ORed - supplying -b would actually enable output buffering.

--- a/sys/src/cmd/grep/main.c
+++ b/sys/src/cmd/grep/main.c
@@ -91,7 +91,7 @@
 	}
 
 	if(flags['b'])
-		flag ^= Bflag;		/* dont buffer output */
+		flag |= Bflag;		/* dont buffer output */
 	if(flags['c'])
 		flag |= Cflag;		/* count */
 	if(flags['h'])
--