summaryrefslogtreecommitdiff
path: root/findutils
diff options
context:
space:
mode:
authorMike Frysinger2005-04-16 04:56:11 +0000
committerMike Frysinger2005-04-16 04:56:11 +0000
commit5ba5f4d2e72791fef3065a2221a3d386e0d17982 (patch)
tree7bf8b5d352ccdbd0bd3ed39d38fcb8fd6eb8663e /findutils
parentb31566ef3273ad32a1e318d9293e44cc50d07b91 (diff)
downloadbusybox-5ba5f4d2e72791fef3065a2221a3d386e0d17982.zip
busybox-5ba5f4d2e72791fef3065a2221a3d386e0d17982.tar.gz
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.
Diffstat (limited to 'findutils')
-rw-r--r--findutils/grep.c4
1 files 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);
}