aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvapier <vapier@69ca8d6d-28ef-0310-b511-8ec308f3f277>2005-04-16 04:56:11 +0000
committervapier <vapier@69ca8d6d-28ef-0310-b511-8ec308f3f277>2005-04-16 04:56:11 +0000
commit9c609205b408396708eea9bf6148d3878cb55118 (patch)
tree7bf8b5d352ccdbd0bd3ed39d38fcb8fd6eb8663e
parentf43aef893fc257d07a21c65b125ff521eb854d82 (diff)
downloadbusybox-w32-9c609205b408396708eea9bf6148d3878cb55118.tar.gz
busybox-w32-9c609205b408396708eea9bf6148d3878cb55118.tar.bz2
busybox-w32-9c609205b408396708eea9bf6148d3878cb55118.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. git-svn-id: svn://busybox.net/trunk/busybox@10115 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r--findutils/grep.c4
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 }