summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorAlejandro Colomar <alx@kernel.org>2023-11-04 20:45:11 +0100
committerAlejandro Colomar <alx@kernel.org>2023-11-05 03:13:44 +0100
commit8b047e331466cc2ccdc0216b44820ee244a5387c (patch)
treeacd0e383c0d51f65c1c5a80cc6a048fc8ae5c6dc /bin
parent518f28157358862ddda3bc94e546447b81e8936f (diff)
bin/grepc, grepc.1: Always enable recursive mode; remove -r
The non-recursive behavior is so slow that it's quite useless. It is only useful when reading from standard input, but for several files it's useless. Make '-r' the default when any files are specified, and remove the flag (since now it's always enabled). This happens to bring back a behavior close to what we had before 55dd5d7255c8 ("Don't find files recursively"). Non-seekable files can still be read, if redirected to standard input. Update the example from the manual page to reflect current usage. Signed-off-by: Alejandro Colomar <alx@kernel.org>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/grepc10
1 files changed, 3 insertions, 7 deletions
diff --git a/bin/grepc b/bin/grepc
index 6d05b25..46919fa 100755
--- a/bin/grepc
+++ b/bin/grepc
@@ -5,7 +5,6 @@
iflag='';
lflag='';
kflag='no';
-rflag='no';
tflag='no';
t_e='no';
t_fp='no';
@@ -39,7 +38,7 @@ grepc_err()
grepc_parse_cmd()
{
- while getopts "chiklrt:" opt; do
+ while getopts "chiklt:" opt; do
case "$opt" in
c)
cflag='yes';
@@ -58,9 +57,6 @@ grepc_parse_cmd()
lflag='l';
kflag='yes';
;;
- r)
- rflag='yes';
- ;;
t)
case "$OPTARG" in
e)
@@ -238,8 +234,8 @@ grepc_search()
grepc_patterns "$identifier" >"$p";
- if test "$rflag" = 'no'; then
- pcre2grep -${iflag}${lflag}HMn -f "$p" $files;
+ if test -z "$files"; then
+ pcre2grep -${iflag}${lflag}HMn -f "$p";
else
find $files -type f \
| xargs grep -${iflag}lPI -- "$identifier" \