mirror of
https://github.com/sheumann/hush.git
synced 2024-12-27 01:32:08 +00:00
Fix behavior of grep -lc to match GNU grep. SuS2 is ambiguous
on the correct behavior, so acting like GNU grep seems best -Erik
This commit is contained in:
parent
af6b40a1ea
commit
0034443140
@ -179,7 +179,10 @@ static void grep_file(FILE *file)
|
|||||||
if (print_match_counts) {
|
if (print_match_counts) {
|
||||||
if (print_filename)
|
if (print_filename)
|
||||||
printf("%s:", cur_file);
|
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 */
|
/* grep -l: print just the filename, but only if we grepped the line in the file */
|
||||||
|
5
grep.c
5
grep.c
@ -179,7 +179,10 @@ static void grep_file(FILE *file)
|
|||||||
if (print_match_counts) {
|
if (print_match_counts) {
|
||||||
if (print_filename)
|
if (print_filename)
|
||||||
printf("%s:", cur_file);
|
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 */
|
/* grep -l: print just the filename, but only if we grepped the line in the file */
|
||||||
|
Loading…
Reference in New Issue
Block a user