Package: grep Severity: wishlist Tags: patch I think it would be a good idea to make rgrep default to searching the current directory instead of stdin. I mean, it doesn't really make sense to recursively grep stdin.
This change shouldn't reasonably break any existing scripts; if there are any
scripts in the field calling rgrep (or even grep -r), I'd expect them to
carefully specify a path to search.
Since knowing whether a file was specified requires scanning the whole command
line, I guess this is better implemented in the grep binary.
The attached patch is however Debian-specific, due to 55-bigfile.patch.
--
Magnus Holmgren [EMAIL PROTECTED]
(No Cc of list mail needed, thanks)
--- src/grep.c.orig 2007-03-09 17:24:06.072003373 +0100
+++ src/grep.c 2007-03-09 17:26:41.982527960 +0100
@@ -1765,7 +1765,12 @@
if (max_count == 0)
exit (1);
- file_list = (optind == argc ? stdin_argv : &argv[optind]);
+ if (optind == argc)
+ {
+ if (directories == RECURSE_DIRECTORIES) stdin_argv[0] = ".";
+ file_list = stdin_argv;
+ }
+ else file_list = &argv[optind];
status = 1;
while (1)
pgpnwKtTx6wsZ.pgp
Description: PGP signature

