summaryrefslogtreecommitdiffstats
path: root/usr.bin/grep
diff options
context:
space:
mode:
authorkevans <kevans@FreeBSD.org>2017-08-15 01:22:39 +0000
committerkevans <kevans@FreeBSD.org>2017-08-15 01:22:39 +0000
commit157a9b28179b3f3136fdebaeea066445fe702ae3 (patch)
tree383e70d8939b9e354fa88a310f147e5bd44e6632 /usr.bin/grep
parentb5bf4d72d917538b415d917959f41c8dd7478798 (diff)
downloadFreeBSD-src-157a9b28179b3f3136fdebaeea066445fe702ae3.zip
FreeBSD-src-157a9b28179b3f3136fdebaeea066445fe702ae3.tar.gz
bsdgrep: treat rgrep as grep -r and install rgrep symlink
MFC r316473: bsdgrep: treat rgrep as grep -r MFC r316484: bsdgrep(1): create rgrep link Create a convenience rgrep link for bsdgrep(1) that observes 'grep -r' behavior. A follow-up to r316473. Approved by: emaste (mentor)
Diffstat (limited to 'usr.bin/grep')
-rw-r--r--usr.bin/grep/Makefile2
-rw-r--r--usr.bin/grep/grep.16
-rw-r--r--usr.bin/grep/grep.c3
3 files changed, 10 insertions, 1 deletions
diff --git a/usr.bin/grep/Makefile b/usr.bin/grep/Makefile
index 1c0e8cc..c2b03ee 100644
--- a/usr.bin/grep/Makefile
+++ b/usr.bin/grep/Makefile
@@ -25,12 +25,14 @@ CFLAGS.gcc+= --param max-inline-insns-single=500
.if ${MK_BSD_GREP} == "yes"
LINKS= ${BINDIR}/grep ${BINDIR}/egrep \
${BINDIR}/grep ${BINDIR}/fgrep \
+ ${BINDIR}/grep ${BINDIR}/rgrep \
${BINDIR}/grep ${BINDIR}/zgrep \
${BINDIR}/grep ${BINDIR}/zegrep \
${BINDIR}/grep ${BINDIR}/zfgrep
MLINKS= grep.1 egrep.1 \
grep.1 fgrep.1 \
+ grep.1 rgrep.1 \
grep.1 zgrep.1 \
grep.1 zegrep.1 \
grep.1 zfgrep.1
diff --git a/usr.bin/grep/grep.1 b/usr.bin/grep/grep.1
index 0cc759d..f06cfaa 100644
--- a/usr.bin/grep/grep.1
+++ b/usr.bin/grep/grep.1
@@ -34,7 +34,7 @@
.Dt GREP 1
.Os
.Sh NAME
-.Nm grep , egrep , fgrep ,
+.Nm grep , egrep , fgrep , rgrep ,
.Nm zgrep , zegrep , zfgrep
.Nd file pattern searcher
.Sh SYNOPSIS
@@ -341,6 +341,10 @@ will only search a file until a match has been found,
making searches potentially less expensive.
.It Fl R , Fl r , Fl Fl recursive
Recursively search subdirectories listed.
+(i.e. force
+.Nm grep
+to behave as
+.Nm rgrep ) .
.It Fl S
If
.Fl R
diff --git a/usr.bin/grep/grep.c b/usr.bin/grep/grep.c
index 2dc5a1d..b85db5a 100644
--- a/usr.bin/grep/grep.c
+++ b/usr.bin/grep/grep.c
@@ -361,6 +361,9 @@ main(int argc, char *argv[])
} else if (pn[0] == 'l' && pn[1] == 'z') {
filebehave = FILE_LZMA;
pn += 2;
+ } else if (pn[0] == 'r') {
+ dirbehave = DIR_RECURSE;
+ Hflag = true;
} else if (pn[0] == 'z') {
filebehave = FILE_GZIP;
pn += 1;
OpenPOWER on IntegriCloud