summaryrefslogtreecommitdiff
path: root/findutils/grep.c
diff options
context:
space:
mode:
Diffstat (limited to 'findutils/grep.c')
-rw-r--r--findutils/grep.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/findutils/grep.c b/findutils/grep.c
index 061462e..07646e0 100644
--- a/findutils/grep.c
+++ b/findutils/grep.c
@@ -60,7 +60,8 @@ static void print_line(const char *line, int linenum, char decoration)
{
#ifdef BB_FEATURE_GREP_CONTEXT
/* possibly print the little '--' seperator */
- if (last_line_printed && last_line_printed < linenum - 1) {
+ if ((lines_before || lines_after) && last_line_printed &&
+ last_line_printed < linenum - 1) {
puts("--");
}
last_line_printed = linenum;