diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2021-08-25 13:15:05 -0700 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2021-08-25 13:15:05 -0700 |
| commit | 9db5e91781b71939fd3cd9dd0e8e922e7d52e449 (patch) | |
| tree | f5dd2802fd6df5af443a0872eef09eecc78f483d /bp.c | |
| parent | d7e18968bb92b853ab8eb691e89196e5e2e6f5db (diff) | |
Only print filenames when there are multiple files
Diffstat (limited to 'bp.c')
| -rw-r--r-- | bp.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -530,6 +530,8 @@ int main(int argc, char *argv[]) } else if (argv[0]) { // Files pass in as command line args: struct stat statbuf; + if (!argv[1]) // Don't print filename for single-file matching + options.print_filenames = false; for ( ; argv[0]; argv++) { if (stat(argv[0], &statbuf) == 0 && S_ISDIR(statbuf.st_mode)) // Symlinks are okay if manually specified found += process_dir(defs, argv[0], pattern); @@ -541,6 +543,7 @@ int main(int argc, char *argv[]) found += process_dir(defs, ".", pattern); } else { // Piped in input: + options.print_filenames = false; // Don't print filename on stdin found += process_file(defs, "", pattern); } if (options.mode == MODE_JSON) printf("]\n"); |
