Fixed extra -- lines (noted by Christophe Boyanique).
authorMatt Kraai <kraai@debian.org>
Tue, 22 May 2001 14:29:27 +0000 (14:29 -0000)
committerMatt Kraai <kraai@debian.org>
Tue, 22 May 2001 14:29:27 +0000 (14:29 -0000)
findutils/grep.c
grep.c

index 061462e..07646e0 100644 (file)
@@ -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;
diff --git a/grep.c b/grep.c
index 061462e..07646e0 100644 (file)
--- a/grep.c
+++ b/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;