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.
This commit is contained in:
Mike Frysinger 2005-04-16 04:56:11 +00:00
parent b31566ef32
commit 5ba5f4d2e7

View File

@ -98,7 +98,7 @@ static void print_line(const char *line, int linenum, char decoration)
} }
last_line_printed = linenum; last_line_printed = linenum;
#endif #endif
if (print_filename) if (print_filename > 0)
printf("%s%c", cur_file, decoration); printf("%s%c", cur_file, decoration);
if (print_line_num) if (print_line_num)
printf("%i%c", linenum, decoration); 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 */ /* grep -c: print [filename:]count, even if count is zero */
if (print_match_counts) { if (print_match_counts) {
if (print_filename) if (print_filename > 0)
printf("%s:", cur_file); printf("%s:", cur_file);
printf("%d\n", nmatches); printf("%d\n", nmatches);
} }