tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: grep -r: add default "."
On Fri, Sep 02, 2022 at 07:08:23PM +0200, Thomas Klausner wrote:
> I'd like the change the behaviour to match what GNU grep does.
Since I saw only positive feedback, here's my proposed patch.
Comments?
Cheers,
Thomas
? bin/.gdbinit
? bin/grep
? bin/grep.html1
? bin/grep.info
Index: dist/doc/grep.1
===================================================================
RCS file: /cvsroot/src/external/gpl2/grep/dist/doc/grep.1,v
retrieving revision 1.2
diff -u -r1.2 grep.1
--- dist/doc/grep.1 10 Jan 2016 22:16:40 -0000 1.2
+++ dist/doc/grep.1 3 Sep 2022 09:05:35 -0000
@@ -2,7 +2,7 @@
.\"
.\" grep man page
.\"d Id: grep.1,v 1.23 2002/01/22 13:20:04 bero Exp
-.TH GREP 1 "June 16 2003" "GNU Project"
+.TH GREP 1 "September 3 2022" "GNU Project"
.SH NAME
grep, egrep, fgrep \- print lines matching a pattern
.SH SYNOPSIS
@@ -312,6 +312,11 @@
this is equivalent to the
.B "\-d recurse"
option.
+If no
+.IR FILE
+is given,
+.BR grep
+searches the current working directory.
.TP
.BR "\fR \fP \-\^\-include=" PATTERN
Recurse in directories only searching file matching
Index: dist/src/grep.c
===================================================================
RCS file: /cvsroot/src/external/gpl2/grep/dist/src/grep.c,v
retrieving revision 1.4
diff -u -r1.4 grep.c
--- dist/src/grep.c 28 Dec 2021 19:22:58 -0000 1.4
+++ dist/src/grep.c 3 Sep 2022 09:05:36 -0000
@@ -1765,9 +1765,10 @@
else
{
if (directories == RECURSE_DIRECTORIES) {
- error (0, 0, _("warning: recursive search of stdin"));
+ status = grepfile(".", &stats_base);
+ } else {
+ status = grepfile ((char *) NULL, &stats_base);
}
- status = grepfile ((char *) NULL, &stats_base);
}
/* We register via atexit() to test stdout. */
Home |
Main Index |
Thread Index |
Old Index