]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
grepc: Remove spurious blank lines
authorAlejandro Colomar <alx.manpages@gmail.com>
Tue, 10 May 2022 17:09:40 +0000 (19:09 +0200)
committerAlejandro Colomar <alx@kernel.org>
Wed, 29 Oct 2025 20:28:55 +0000 (21:28 +0100)
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
bin/grepc

index 9f6f1ffbe18dc51a33f05d52e02af04936753dfd..72af10304e43d0af1525703c4654882858dfe867 100755 (executable)
--- a/bin/grepc
+++ b/bin/grepc
@@ -57,8 +57,8 @@ function grepc_enum_constant()
 {
        grepc_helper \
          '^enum\s' \
-         "^\s*$1\s*[,=]" \
-         "(?s)\benum\b\s*([\w\s[\]]|::)*\s*{[^}]*^\s*$1\s*[=,].*?^}.*?;";
+         "^[ \t]*$1\s*[,=]" \
+         "(?s)\benum\b\s*([\w\s[\]]|::)*\s*{[^}]*^[ \t]*$1\s*[=,].*?^}.*?;";
 }
 
 
@@ -129,25 +129,25 @@ function grepc_type_struct_union_enum()
        grepc_helper \
          "\b(struct|union|enum)\s+$1\b" \
          '.' \
-         "(?s)^(?!^\s*typedef\b)([\w[]([\w\s\(,\)[\]*]|::)*[\w\s\)*\]]\s+)?\b(struct|union|enum)\s+$1\b\s*[\w\s[\]]*{.*?^}.*?;";
+         "(?s)^(?!^[ \t]*typedef\b)([\w[]([\w\s\(,\)[\]*]|::)*[\w\s\)*\]]\s+)?\b(struct|union|enum)\s+$1\b\s*[\w\s[\]]*{.*?^}.*?;";
 }
 
 
 function grepc_type_typedef_simple()
 {
        grepc_helper \
-         '^\s*typedef\s' \
+         '^[ \t]*typedef\s' \
          "\b$1;" \
-         "(?s)^\s*typedef\s+[^{};]+$1;";
+         "(?s)^[ \t]*typedef\s+[^{};]+$1;";
 }
 
 
 function grepc_type_typedef_struct_union_enum()
 {
        grepc_helper \
-         '^\s*typedef\s+(struct|union|enum)\b[^;]*$' \
+         '^[ \t]*typedef\s+(struct|union|enum)\b[^;]*$' \
          "^(  )?}\s*$1;" \
-         "(?s)^\s*typedef\s+(struct|union|enum)\s+(?:(?!^(  )?}|^\s*typedef).)*^(  )?}\s*$1;";
+         "(?s)^[ \t]*typedef\s+(struct|union|enum)\s+(?:(?!^(  )?}|^\s*typedef).)*^(  )?}\s*$1;";
 }