]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
grepc: grepc_enum_constant: Fix edge cases
authorAlejandro Colomar <alx.manpages@gmail.com>
Sat, 14 May 2022 22:52:03 +0000 (00:52 +0200)
committerAlejandro Colomar <alx@kernel.org>
Wed, 29 Oct 2025 20:29:01 +0000 (21:29 +0100)
Most importantly, typedef enum.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
bin/grepc

index 80def61434490189279055fdae4a87c0a3cef22d..173cf2b93d4efc12739f432ecae5f806cb87151c 100755 (executable)
--- a/bin/grepc
+++ b/bin/grepc
@@ -119,9 +119,9 @@ grepc_helper()
 grepc_enum_constant()
 {
        grepc_helper \
-         '^enum\s' \
-         "^[ \t]*$1\s*[,=]" \
-         "(?s)\benum\b\s*([\w\s[\]]|::)*\s*{[^}]*^[ \t]*$1\s*[=,].*?^}.*?;";
+         '\benum\b' \
+         "^[ \t]*$1\b\s*[,=]" \
+         "(?s)^([\w[]+[\w\s]*)?\benum\b\s*([\w\s[\]]|::)*\s*{[^}]*^[ \t]*$1\b\s*[=,].*?^}.*?;";
 }