]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
grepc: grepc_func_def: Increase robustness of regex
authorAlejandro Colomar <alx.manpages@gmail.com>
Fri, 6 May 2022 21:16:42 +0000 (23:16 +0200)
committerAlejandro Colomar <alx@kernel.org>
Wed, 29 Oct 2025 20:28:45 +0000 (21:28 +0100)
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
bin/grepc

index f223afaa7f9cbbc98794aede4265c69a1058ed8c..e9b687792f4a2e90b6b9c9cc811aa91372d555b4 100755 (executable)
--- a/bin/grepc
+++ b/bin/grepc
@@ -54,7 +54,8 @@ function grepc_func_def()
        | grep '\.[ch]$' \
        | xargs grep -l "^$1\b" \
        | sort \
-       | xargs pcregrep -Mn "(?s)^\$[\w\s*]+?^$1\(.*?^}" /dev/null \
+       | xargs pcregrep -Mn \
+         "(?s)^[\w\s*]+?^$1\([\w\s(,)[\]*]+?(...)?\)\s*{.*?^}" /dev/null \
        | sed -E 's/^[^: ]+:[0-9]+:/\n\n&/';
 }