diff options
author | Mike Frysinger <vapier@gentoo.org> | 2005-04-16 04:56:11 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2005-04-16 04:56:11 +0000 |
commit | 5ba5f4d2e72791fef3065a2221a3d386e0d17982 (patch) | |
tree | 7bf8b5d352ccdbd0bd3ed39d38fcb8fd6eb8663e | |
parent | b31566ef3273ad32a1e318d9293e44cc50d07b91 (diff) | |
download | busybox-w32-5ba5f4d2e72791fef3065a2221a3d386e0d17982.tar.gz busybox-w32-5ba5f4d2e72791fef3065a2221a3d386e0d17982.tar.bz2 busybox-w32-5ba5f4d2e72791fef3065a2221a3d386e0d17982.zip |
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.
-rw-r--r-- | findutils/grep.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/findutils/grep.c b/findutils/grep.c index 29f4ecd4f..9b26add9a 100644 --- a/findutils/grep.c +++ b/findutils/grep.c | |||
@@ -98,7 +98,7 @@ static void print_line(const char *line, int linenum, char decoration) | |||
98 | } | 98 | } |
99 | last_line_printed = linenum; | 99 | last_line_printed = linenum; |
100 | #endif | 100 | #endif |
101 | if (print_filename) | 101 | if (print_filename > 0) |
102 | printf("%s%c", cur_file, decoration); | 102 | printf("%s%c", cur_file, decoration); |
103 | if (print_line_num) | 103 | if (print_line_num) |
104 | printf("%i%c", linenum, decoration); | 104 | printf("%i%c", linenum, decoration); |
@@ -219,7 +219,7 @@ static int grep_file(FILE *file) | |||
219 | 219 | ||
220 | /* grep -c: print [filename:]count, even if count is zero */ | 220 | /* grep -c: print [filename:]count, even if count is zero */ |
221 | if (print_match_counts) { | 221 | if (print_match_counts) { |
222 | if (print_filename) | 222 | if (print_filename > 0) |
223 | printf("%s:", cur_file); | 223 | printf("%s:", cur_file); |
224 | printf("%d\n", nmatches); | 224 | printf("%d\n", nmatches); |
225 | } | 225 | } |