summaryrefslogtreecommitdiff
path: root/usr.bin/mg/grep.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/mg/grep.c')
-rw-r--r--usr.bin/mg/grep.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/mg/grep.c b/usr.bin/mg/grep.c
index 97d22c68a81..016256f64d0 100644
--- a/usr.bin/mg/grep.c
+++ b/usr.bin/mg/grep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: grep.c,v 1.48 2019/07/11 18:20:18 lum Exp $ */
+/* $OpenBSD: grep.c,v 1.49 2021/03/01 10:51:14 lum Exp $ */
/* This file is in the public domain */
@@ -216,7 +216,7 @@ compile_mode(const char *name, const char *command)
return (NULL);
}
while ((len = getline(&buf, &sz, fpipe)) != -1) {
- if (buf[len - 1] == '\n')
+ if (buf[len - 1] == *bp->b_nlchr)
buf[len - 1] = '\0';
addline(bp, buf);
}