From 5ba5f4d2e72791fef3065a2221a3d386e0d17982 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 16 Apr 2005 04:56:11 +0000 Subject: [PATCH] In Bug 78, shortkey points out: If you run `grep -h . file1 file2 file3 ...`, the output is not prefixed with the filename. If you run `grep -h . file1` however, the filename will incorrectly prefix the output. --- findutils/grep.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/findutils/grep.c b/findutils/grep.c index 29f4ecd..9b26add 100644 --- a/findutils/grep.c +++ b/findutils/grep.c @@ -98,7 +98,7 @@ static void print_line(const char *line, int linenum, char decoration) } last_line_printed = linenum; #endif - if (print_filename) + if (print_filename > 0) printf("%s%c", cur_file, decoration); if (print_line_num) printf("%i%c", linenum, decoration); @@ -219,7 +219,7 @@ static int grep_file(FILE *file) /* grep -c: print [filename:]count, even if count is zero */ if (print_match_counts) { - if (print_filename) + if (print_filename > 0) printf("%s:", cur_file); printf("%d\n", nmatches); } -- 2.7.4