diff options
author | Alejandro Colomar <alx@kernel.org> | 2023-11-03 18:48:51 +0100 |
---|---|---|
committer | Alejandro Colomar <alx@kernel.org> | 2023-11-03 23:05:49 +0100 |
commit | d34c191fce67f9f22b974c6db9a6ef14f5479d79 (patch) | |
tree | 1156b9b382793ba4a91d35555e2ab030c95f8dee | |
parent | 35ff99a8399b8f140c817d554b38eb37aecf544b (diff) |
Allow specifying several files
Signed-off-by: Alejandro Colomar <alx@kernel.org>
-rwxr-xr-x | bin/grepc | 9 | ||||
-rw-r--r-- | share/man/man1/grepc.1 | 2 |
2 files changed, 3 insertions, 8 deletions
@@ -156,12 +156,7 @@ grepc_parse_cmd() identifier=$1; shift; - if [ $# -gt 0 ]; then - file="$1"; - shift; - fi; - - test $# -gt 1 && grepc_err "Trailing unknown arguments."; + files=$*; if [ "$tflag" = 'no' ]; then t_e='yes'; @@ -237,7 +232,7 @@ main() { grepc_parse_cmd "$@" </dev/null; - pcre2grep -${iflag}${lflag}HMn -f <(grepc_patterns "$identifier") $file \ + pcre2grep -${iflag}${lflag}HMn -f <(grepc_patterns "$identifier") $files \ | sed -E -f <(test "$kflag" = 'no' && echo 's/^[^: ]+:[0-9]+:/\n\n&\n/') \ | perl -pe "$(test "$cflag" = 'yes' && echo 's/('"$identifier"')/\033[32m\1\033[0m/' || echo 's///')" \ | if [ -n "$lflag" ]; then diff --git a/share/man/man1/grepc.1 b/share/man/man1/grepc.1 index e80c648..8785020 100644 --- a/share/man/man1/grepc.1 +++ b/share/man/man1/grepc.1 @@ -5,7 +5,7 @@ grepc \- find C declarations, definitions, and uses in source code .B grepc .RI [ option\~ .\|.\|.\&] .I pattern -.RI [ file ] +.RI [ file\~ .\|.\|.\&] .SH DESCRIPTION .MR grepc 1 searches for C declarations, definitions, and/or uses of |