diff options
author | Eric Andersen | 2001-07-31 23:18:49 +0000 |
---|---|---|
committer | Eric Andersen | 2001-07-31 23:18:49 +0000 |
commit | 00344431402703089c6b93f6119f9966cc7ba566 (patch) | |
tree | 168e32bc0921e40feb47f26326b50f4885b05131 /findutils/grep.c | |
parent | af6b40a1ea1376ba1a17b877c9320f398bc6d01a (diff) | |
download | busybox-00344431402703089c6b93f6119f9966cc7ba566.zip busybox-00344431402703089c6b93f6119f9966cc7ba566.tar.gz |
Fix behavior of grep -lc to match GNU grep. SuS2 is ambiguous
on the correct behavior, so acting like GNU grep seems best
-Erik
Diffstat (limited to 'findutils/grep.c')
-rw-r--r-- | findutils/grep.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/findutils/grep.c b/findutils/grep.c index 03cc9f8..3254868 100644 --- a/findutils/grep.c +++ b/findutils/grep.c @@ -179,7 +179,10 @@ static void grep_file(FILE *file) if (print_match_counts) { if (print_filename) printf("%s:", cur_file); - printf("%d\n", nmatches); + if (print_files_with_matches && nmatches > 0) + printf("1\n"); + else + printf("%d\n", nmatches); } /* grep -l: print just the filename, but only if we grepped the line in the file */ |