diff options
author | Alejandro Colomar <alx.manpages@gmail.com> | 2022-05-08 22:04:55 +0200 |
---|---|---|
committer | Alejandro Colomar <alx.manpages@gmail.com> | 2022-05-08 22:44:24 +0200 |
commit | cc589772ab8f77996a070928291f47002cee09b0 (patch) | |
tree | af4e1385dd72c161901707de1ce68259303f02b4 /bin/grepc | |
parent | 3df50d106af5de5adca5e8b6a21c6d34cdac8c73 (diff) |
grepc: grepc_enum_constant: Find enumeration constant definitions
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Diffstat (limited to 'bin/grepc')
-rwxr-xr-x | bin/grepc | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -36,6 +36,18 @@ function grepc_macro() } +function grepc_enum_constant() +{ + find . -type f \ + | grep '\.[ch]$' \ + | xargs grep -l "\b$1\s*=" \ + | sort \ + | xargs pcregrep -Mn \ + "(?s)\benum\b\s*[\w\s[\]]*{[^}]*\b$1\s*[=,].*?^}.*?;" /dev/null \ + | sed -E 's/^[^: ]+:[0-9]+:/\n\n&\n\n/'; +} + + function grepc_func_decl() { find . -type f \ @@ -168,6 +180,7 @@ function grepc_type() function main() { grepc_macro "$1"; + grepc_enum_constant "$1"; grepc_func "$1"; grepc_syscall "$1"; grepc_type "$1"; |