summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Musolino <alex@musolino.id.au>2020-03-26 18:24:39 +1030
committerAlex Musolino <alex@musolino.id.au>2020-03-26 18:24:39 +1030
commit47e3c088c90944e49041c8b210dd7169479738da (patch)
tree07adea1c23c4f7a5d459504023947b853395011e
parent2f67e21393c25943f25e116fa6912b7d92dbca4e (diff)
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.
-rw-r--r--sys/src/cmd/grep/main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/src/cmd/grep/main.c b/sys/src/cmd/grep/main.c
index d17be9c59..9ef2ba6e8 100644
--- a/sys/src/cmd/grep/main.c
+++ b/sys/src/cmd/grep/main.c
@@ -91,7 +91,7 @@ search(char *file, int flag)
}
if(flags['b'])
- flag ^= Bflag; /* dont buffer output */
+ flag |= Bflag; /* dont buffer output */
if(flags['c'])
flag |= Cflag; /* count */
if(flags['h'])