From 5eda0d4b881e252937e7ff44fa9876418e7684bb Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Mon, 23 Aug 2021 22:33:58 -0700 Subject: Only print all input if input is stdin *and* context is ALL --- bp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bp.c') diff --git a/bp.c b/bp.c index d9aca3b..6243fd2 100644 --- a/bp.c +++ b/bp.c @@ -249,7 +249,7 @@ static int print_matches(FILE *out, def_t *defs, file_t *f, pat_t *pattern) } if (m) recycle_if_unused(&m); - if (matches > 0 || f->filename[0] == '\0') { + if (matches > 0 || (f->filename[0] == '\0' && options.context_before == ALL_CONTEXT)) { // Print trailing context lines: print_match(out, &pr, NULL); } -- cgit v1.2.3