]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
Allow specifying several files
authorAlejandro Colomar <alx@kernel.org>
Fri, 3 Nov 2023 17:48:51 +0000 (18:48 +0100)
committerAlejandro Colomar <alx@kernel.org>
Wed, 29 Oct 2025 20:29:18 +0000 (21:29 +0100)
Signed-off-by: Alejandro Colomar <alx@kernel.org>
bin/grepc
share/man/man1/grepc.1

index 23c9e3c9dfc2456993ca9bfa70dead2ae0dfab3d..db053d98e27ef4163d96e1e25ada1810dd158dab 100755 (executable)
--- a/bin/grepc
+++ b/bin/grepc
@@ -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
index e80c648f079794ff435ff59ed418954b596fbcb7..87850204dcbb733300e36b9b36f24f1e3c1b6e8e 100644 (file)
@@ -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