]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
src/bin/grepc{,_c,_mk}: Align code after split
authorAlejandro Colomar <alx@kernel.org>
Sun, 2 Nov 2025 16:11:42 +0000 (17:11 +0100)
committerAlejandro Colomar <alx@kernel.org>
Mon, 3 Nov 2025 10:42:40 +0000 (11:42 +0100)
Signed-off-by: Alejandro Colomar <alx@kernel.org>
src/bin/grepc
src/bin/grepc_c
src/bin/grepc_mk

index 6e82500ddf2562b9f63ef3cfed2a3abf5682f13c..8e3caa0a5c8a49566036f174564f9e4acd314ef7 100755 (executable)
@@ -31,16 +31,16 @@ grepc_err()
 
 while getopts "A:B:C:chilm:nrt:x:" opt; do
        case "$opt" in
-       A)      A="-A$OPTARG";  ;;
-       B)      B="-B$OPTARG";  ;;
-       C)      C="-C$OPTARG";  ;;
-       c)      c='-c';         ;;
-       h)      h='-h';         ;;
-       i)      i='-i';         ;;
-       l)      l='-l';         ;;
-       m)      m="-m$OPTARG";  ;;
-       n)      n='-n';         ;;
-       r)      r='yes';        ;;
+       A)      A="-A$OPTARG";          ;;
+       B)      B="-B$OPTARG";          ;;
+       C)      C="-C$OPTARG";          ;;
+       c)      c='-c';                 ;;
+       h)      h='-h';                 ;;
+       i)      i='-i';                 ;;
+       l)      l='-l';                 ;;
+       m)      m="-m$OPTARG";          ;;
+       n)      n='-n';                 ;;
+       r)      r='yes';                ;;
        t)      t="$t -t$OPTARG";       ;;
        x)
                if test -n "$x"; then
index 588825b0a1ebbd241f7f0576eeda00cb0328764e..73366dc11ce04e0a7e243b683103b772a39eb0d5 100755 (executable)
@@ -41,36 +41,36 @@ grepc_err()
 while getopts "t:" opt; do
        case "$opt" in
        t)
-                       case "$OPTARG" in
-                       e)              t_e='yes';              ;;&
-                       f | fp)         t_fp='yes';             ;;&
-                       f | fd)         t_fd='yes';             ;;&
-                       f | fl | flp)   t_flp='yes';            ;;&
-                       f | fl | fld)   t_fld='yes';            ;;&
-                       f | fg | fgp)   t_fgp='yes';            ;;&
-                       f | fg | fgd)   t_fgd_libm='yes';
-                                       t_fgd_libio='yes';      ;;&
-                       m | mf)         t_mf='yes';             ;;&
-                       m | mo)         t_mo='yes';             ;;&
-                       t)              t_t_braced='yes';
-                                       t_t_td_simple='yes';
-                                       t_t_td_braced='yes';
-                                       t_t_td_func='yes';      ;;&
-                       u | ue)         t_ue='yes';             ;;&
-                       u | uf)         t_uf_def='yes';
-                                       t_uf_linux_def='yes';   ;;&
-                       u | um)         t_um='yes';             ;;&
-                       u | ut)         t_ut_su='yes';
-                                       t_ut_td_simple='yes';
-                                       t_ut_td_su='yes';       ;;&
-                       [efmtu] | f[pdlg] | fl[pd] | fg[pd] | m[fo] | u[efmt])
-                                       t='yes';
-                                       ;;
-                       *)
-                                       grepc_err "-$opt: $OPTARG: Unknown argument.";
-                                       ;;
-                       esac;
-                       ;;
+               case "$OPTARG" in
+               e)              t_e='yes';              ;;&
+               f | fp)         t_fp='yes';             ;;&
+               f | fd)         t_fd='yes';             ;;&
+               f | fl | flp)   t_flp='yes';            ;;&
+               f | fl | fld)   t_fld='yes';            ;;&
+               f | fg | fgp)   t_fgp='yes';            ;;&
+               f | fg | fgd)   t_fgd_libm='yes';
+                               t_fgd_libio='yes';      ;;&
+               m | mf)         t_mf='yes';             ;;&
+               m | mo)         t_mo='yes';             ;;&
+               t)              t_t_braced='yes';
+                               t_t_td_simple='yes';
+                               t_t_td_braced='yes';
+                               t_t_td_func='yes';      ;;&
+               u | ue)         t_ue='yes';             ;;&
+               u | uf)         t_uf_def='yes';
+                               t_uf_linux_def='yes';   ;;&
+               u | um)         t_um='yes';             ;;&
+               u | ut)         t_ut_su='yes';
+                               t_ut_td_simple='yes';
+                               t_ut_td_su='yes';       ;;&
+               [efmtu] | f[pdlg] | fl[pd] | fg[pd] | m[fo] | u[efmt])
+                               t='yes';
+                               ;;
+               *)
+                               grepc_err "-$opt: $OPTARG: Unknown argument.";
+                               ;;
+               esac;
+               ;;
        \? | *)
                exit 1;
                ;;
@@ -89,66 +89,66 @@ if test $# -gt 0; then
 fi;
 
 if test "$t" = 'no'; then
-               t_e='yes';
-               t_fp='yes';
-               t_fd='yes';
-               t_flp='yes';
-               t_fld='yes';
-               t_fgp='yes';
-               t_fgd_libm='yes';
-               t_fgd_libio='yes';
-               t_mf='yes';
-               t_mo='yes';
-               t_t_braced='yes';
-               t_t_td_simple='yes';
-               t_t_td_braced='yes';
-               t_t_td_func='yes';
+       t_e='yes';
+       t_fp='yes';
+       t_fd='yes';
+       t_flp='yes';
+       t_fld='yes';
+       t_fgp='yes';
+       t_fgd_libm='yes';
+       t_fgd_libio='yes';
+       t_mf='yes';
+       t_mo='yes';
+       t_t_braced='yes';
+       t_t_td_simple='yes';
+       t_t_td_braced='yes';
+       t_t_td_func='yes';
 fi;
 
 
-grepc_c_e()            { printf '%s\n' '(?s)^([\w[]+[\w\s]*)?\benum\b[ \t]*([\w \t[\]]|::)*\n*([ \t]*){[^}]*^[ \t]*'"$1"'\b\s*[=,].*?^\3}.*?;'; }
-grepc_c_f_decl_()      { printf '%s' '(?s)^[\w[](?:[\w\s\(,\)[\]*]|::)+[\w\s\)*\]]\s+\**\(?'"$1"'\)?\s*(\((?:[\w\s,;[\]*]|::|(?1))*(?:\.\.\.)?\))'; }
-grepc_c_fp()           { grepc_c_f_decl_ "$1"; printf '%s\n' '(?:[\w\s\(,\)[\]]|::)*;'; }
-grepc_c_fd()           { grepc_c_f_decl_ "$1"; printf '%s\n' '[ \t]*\n(?<space>[ \t]*){.*?^\k<space>}'; }
-grepc_c_fgd_libm()     { grepc_c_fd "M_DECL_FUNC \(__$1\)"; }
-grepc_c_fgd_libio()    { grepc_c_fd "_IO_$1"; }
-grepc_c_fgp_libio()    { grepc_c_fp "_IO_$1"; }
-grepc_c_fgp()          { grepc_c_fgp_libio "$1"; }
-grepc_c_flp()          { printf '%s\n' '(?s)^asmlinkage\s+[\w\s]+\**sys_'"$1"'\s*\(.*?\)'; }
-grepc_c_fld()          { printf '%s\n' '(?s)^(COMPAT_)?SYSCALL_DEFINE.\('"$1"'\b.*?^}'; }
-grepc_c_mf()           { printf '%s\n' '(?s)^[ \t]*#\s*define\s[\s\\]*'"$1"'\(.*?[^\\]$'; }
-grepc_c_mo()           { printf '%s\n' '(?s)^[ \t]*#\s*define\s[\s\\]*'"$1"'\b(?!\().*?(?<!\\)$'; }
-grepc_c_t_braced()     { printf '%s\n' '(?s)^([\w[]([\w\s\(,\)[\]*]|::)*[\w\s\)*\]]\s+)?\b(struct|union|enum)\b([\w \t[\]]|::)+\b'"$1"'\b[ \t]*\n*([ \t]*){.*?^\5}.*?;'; }
-grepc_c_t_td_simple()  { printf '%s\n' '(?s)^[ \t]*typedef\s+[^{};]+\b'"$1"';'; }
-grepc_c_t_td_braced()  { printf '%s\n' '(?s)^[ \t]*typedef\s+(struct|union|enum)\b(?:(?!\W'"$1"'\W)([\w \t[\]]|::))*\n*([ \t]*){(?:(?!^\3?}).)*?^\3}\s*'"$1"'(\[[\w\(,\)]\])*;'; }
-grepc_c_t_td_func()    { printf '%s\n' '(?s)^[ \t]*typedef\s+[^{};]+\(\**'"$1"'\)\s*\([^{};]+;'; }
-grepc_c_ue()           { printf '%s\n' '(?s)^([\w[]+[\w\s]*)?\benum\b([\w \t[\]]|::)*\n*([ \t]*){[^}]*^\s*\w+[\w\s[\]=]*'"$1"'.*?^\3}.*?;'; }
-grepc_c_uf_def()       { grepc_c_f_decl_ '\w+'; printf '%s\n' '[ \t]*\n*(?<space>[ \t]*){(?:(?!^\k<space>?}).)*'"$1"'.*?^\k<space>}'; }
-grepc_c_uf_linux_def() { printf '%s\n' '(?s)^(COMPAT_)?SYSCALL_DEFINE.\(\w+\b(?:(?!^}).)*'"$1"'.?^}'; }
-grepc_c_um()           { printf '%s\n' '(?s)^[ \t]*#\s*define\s[\s\\]*\w+\b(\([^\)]*\))?(?:(?![^\\]$).)*'"$1"'.*?[^\\]$'; }
-grepc_c_ut_su()                { printf '%s\n' '(?s)^(?!^[ \t]*typedef\b)([\w[]([\w\s\(,\)[\]*]|::)*[\w\s\)*\]]\s+)?\b(struct|union)\b([\w \t[\]]|::)*\w+[ \t]*\n*([ \t]*){(?:(?!^\5?}).)*?'"$1"'.*?^\5}.*?;'; }
-grepc_c_ut_td_simple() { printf '%s\n' '(?s)^[ \t]*typedef\s+[^{};]*'"$1"'[^{};]+;'; }
-grepc_c_ut_td_su()     { printf '%s\n' '(?s)^[ \t]*typedef\s+(struct|union)\b([\w \t[\]]|::)*\n*([ \t]*){(?:(?!^\3?}|^\s*typedef).)*'"$1"'(?:(?!^\3?}|^\s*typedef).)*^\3}\s*\w+;'; }
+grepc_c_e()             { printf '%s\n' '(?s)^([\w[]+[\w\s]*)?\benum\b[ \t]*([\w \t[\]]|::)*\n*([ \t]*){[^}]*^[ \t]*'"$1"'\b\s*[=,].*?^\3}.*?;'; }
+grepc_c_f_decl_()       { printf '%s' '(?s)^[\w[](?:[\w\s\(,\)[\]*]|::)+[\w\s\)*\]]\s+\**\(?'"$1"'\)?\s*(\((?:[\w\s,;[\]*]|::|(?1))*(?:\.\.\.)?\))'; }
+grepc_c_fp()            { grepc_c_f_decl_ "$1"; printf '%s\n' '(?:[\w\s\(,\)[\]]|::)*;'; }
+grepc_c_fd()            { grepc_c_f_decl_ "$1"; printf '%s\n' '[ \t]*\n(?<space>[ \t]*){.*?^\k<space>}'; }
+grepc_c_fgd_libm()      { grepc_c_fd "M_DECL_FUNC \(__$1\)"; }
+grepc_c_fgd_libio()     { grepc_c_fd "_IO_$1"; }
+grepc_c_fgp_libio()     { grepc_c_fp "_IO_$1"; }
+grepc_c_fgp()           { grepc_c_fgp_libio "$1"; }
+grepc_c_flp()           { printf '%s\n' '(?s)^asmlinkage\s+[\w\s]+\**sys_'"$1"'\s*\(.*?\)'; }
+grepc_c_fld()           { printf '%s\n' '(?s)^(COMPAT_)?SYSCALL_DEFINE.\('"$1"'\b.*?^}'; }
+grepc_c_mf()            { printf '%s\n' '(?s)^[ \t]*#\s*define\s[\s\\]*'"$1"'\(.*?[^\\]$'; }
+grepc_c_mo()            { printf '%s\n' '(?s)^[ \t]*#\s*define\s[\s\\]*'"$1"'\b(?!\().*?(?<!\\)$'; }
+grepc_c_t_braced()      { printf '%s\n' '(?s)^([\w[]([\w\s\(,\)[\]*]|::)*[\w\s\)*\]]\s+)?\b(struct|union|enum)\b([\w \t[\]]|::)+\b'"$1"'\b[ \t]*\n*([ \t]*){.*?^\5}.*?;'; }
+grepc_c_t_td_simple()   { printf '%s\n' '(?s)^[ \t]*typedef\s+[^{};]+\b'"$1"';'; }
+grepc_c_t_td_braced()   { printf '%s\n' '(?s)^[ \t]*typedef\s+(struct|union|enum)\b(?:(?!\W'"$1"'\W)([\w \t[\]]|::))*\n*([ \t]*){(?:(?!^\3?}).)*?^\3}\s*'"$1"'(\[[\w\(,\)]\])*;'; }
+grepc_c_t_td_func()     { printf '%s\n' '(?s)^[ \t]*typedef\s+[^{};]+\(\**'"$1"'\)\s*\([^{};]+;'; }
+grepc_c_ue()            { printf '%s\n' '(?s)^([\w[]+[\w\s]*)?\benum\b([\w \t[\]]|::)*\n*([ \t]*){[^}]*^\s*\w+[\w\s[\]=]*'"$1"'.*?^\3}.*?;'; }
+grepc_c_uf_def()        { grepc_c_f_decl_ '\w+'; printf '%s\n' '[ \t]*\n*(?<space>[ \t]*){(?:(?!^\k<space>?}).)*'"$1"'.*?^\k<space>}'; }
+grepc_c_uf_linux_def()  { printf '%s\n' '(?s)^(COMPAT_)?SYSCALL_DEFINE.\(\w+\b(?:(?!^}).)*'"$1"'.?^}'; }
+grepc_c_um()            { printf '%s\n' '(?s)^[ \t]*#\s*define\s[\s\\]*\w+\b(\([^\)]*\))?(?:(?![^\\]$).)*'"$1"'.*?[^\\]$'; }
+grepc_c_ut_su()         { printf '%s\n' '(?s)^(?!^[ \t]*typedef\b)([\w[]([\w\s\(,\)[\]*]|::)*[\w\s\)*\]]\s+)?\b(struct|union)\b([\w \t[\]]|::)*\w+[ \t]*\n*([ \t]*){(?:(?!^\5?}).)*?'"$1"'.*?^\5}.*?;'; }
+grepc_c_ut_td_simple()  { printf '%s\n' '(?s)^[ \t]*typedef\s+[^{};]*'"$1"'[^{};]+;'; }
+grepc_c_ut_td_su()      { printf '%s\n' '(?s)^[ \t]*typedef\s+(struct|union)\b([\w \t[\]]|::)*\n*([ \t]*){(?:(?!^\3?}|^\s*typedef).)*'"$1"'(?:(?!^\3?}|^\s*typedef).)*^\3}\s*\w+;'; }
 
 
-               if test "$t_e" = yes;                   then grepc_c_e "$identifier";                   fi;
-               if test "$t_fp" = yes;                  then grepc_c_fp "$identifier";                  fi;
-               if test "$t_fd" = yes;                  then grepc_c_fd "$identifier";                  fi;
-               if test "$t_flp" = yes;                 then grepc_c_flp "$identifier";                 fi;
-               if test "$t_fld" = yes;                 then grepc_c_fld "$identifier";                 fi;
-               if test "$t_fgp" = yes;                 then grepc_c_fgp "$identifier";                 fi;
-               if test "$t_fgd_libm" = yes;            then grepc_c_fgd_libm "$identifier";            fi;
-               if test "$t_fgd_libio" = yes;           then grepc_c_fgd_libio "$identifier";           fi;
-               if test "$t_mf" = yes;                  then grepc_c_mf "$identifier";                  fi;
-               if test "$t_mo" = yes;                  then grepc_c_mo "$identifier";                  fi;
-               if test "$t_t_braced" = yes;            then grepc_c_t_braced "$identifier";            fi;
-               if test "$t_t_td_simple" = yes;         then grepc_c_t_td_simple "$identifier";         fi;
-               if test "$t_t_td_braced" = yes;         then grepc_c_t_td_braced "$identifier";         fi;
-               if test "$t_t_td_func" = yes;           then grepc_c_t_td_func "$identifier";           fi;
-               if test "$t_ue" = yes;                  then grepc_c_ue "$identifier";                  fi;
-               if test "$t_uf_def" = yes;              then grepc_c_uf_def "$identifier";              fi;
-               if test "$t_uf_linux_def" = yes;        then grepc_c_uf_linux_def "$identifier";        fi;
-               if test "$t_um" = yes;                  then grepc_c_um "$identifier";                  fi;
-               if test "$t_ut_su" = yes;               then grepc_c_ut_su "$identifier";               fi;
-               if test "$t_ut_td_simple" = yes;        then grepc_c_ut_td_simple "$identifier";        fi;
-               if test "$t_ut_td_su" = yes;            then grepc_c_ut_td_su "$identifier";            fi;
+if test "$t_e" = yes;             then grepc_c_e "$identifier";             fi;
+if test "$t_fp" = yes;            then grepc_c_fp "$identifier";            fi;
+if test "$t_fd" = yes;            then grepc_c_fd "$identifier";            fi;
+if test "$t_flp" = yes;           then grepc_c_flp "$identifier";           fi;
+if test "$t_fld" = yes;           then grepc_c_fld "$identifier";           fi;
+if test "$t_fgp" = yes;           then grepc_c_fgp "$identifier";           fi;
+if test "$t_fgd_libm" = yes;      then grepc_c_fgd_libm "$identifier";      fi;
+if test "$t_fgd_libio" = yes;     then grepc_c_fgd_libio "$identifier";     fi;
+if test "$t_mf" = yes;            then grepc_c_mf "$identifier";            fi;
+if test "$t_mo" = yes;            then grepc_c_mo "$identifier";            fi;
+if test "$t_t_braced" = yes;      then grepc_c_t_braced "$identifier";      fi;
+if test "$t_t_td_simple" = yes;   then grepc_c_t_td_simple "$identifier";   fi;
+if test "$t_t_td_braced" = yes;   then grepc_c_t_td_braced "$identifier";   fi;
+if test "$t_t_td_func" = yes;     then grepc_c_t_td_func "$identifier";     fi;
+if test "$t_ue" = yes;            then grepc_c_ue "$identifier";            fi;
+if test "$t_uf_def" = yes;        then grepc_c_uf_def "$identifier";        fi;
+if test "$t_uf_linux_def" = yes;  then grepc_c_uf_linux_def "$identifier";  fi;
+if test "$t_um" = yes;            then grepc_c_um "$identifier";            fi;
+if test "$t_ut_su" = yes;         then grepc_c_ut_su "$identifier";         fi;
+if test "$t_ut_td_simple" = yes;  then grepc_c_ut_td_simple "$identifier";  fi;
+if test "$t_ut_td_su" = yes;      then grepc_c_ut_td_su "$identifier";      fi;
index 03ae04a464a9ae85deca855efa30f10c0170918d..790b55acc9bc52489b5f32bc7336587afaf06ab6 100755 (executable)
@@ -22,17 +22,17 @@ grepc_err()
 while getopts "t:" opt; do
        case "$opt" in
        t)
-                       case "$OPTARG" in
-                       r)              t_r='yes';              ;;&
-                       v)              t_v='yes';              ;;&
-                       [rv])
-                                       t='yes';
-                                       ;;
-                       *)
-                                       grepc_err "-$opt: $OPTARG: Unknown argument.";
-                                       ;;
-                       esac;
+               case "$OPTARG" in
+               r)      t_r='yes';      ;;&
+               v)      t_v='yes';      ;;&
+               [rv])
+                       t='yes';
                        ;;
+               *)
+                       grepc_err "-$opt: $OPTARG: Unknown argument.";
+                       ;;
+               esac;
+               ;;
        \? | *)
                exit 1;
                ;;
@@ -51,13 +51,13 @@ if test $# -gt 0; then
 fi;
 
 if test "$t" = 'no'; then
-               t_v='yes';
+       t_v='yes';
 fi;
 
 
-grepc_mk_r()           { printf '%s\n' '(?s)^(\$\()?'"$1"'\)?\s*:[^=].*?(?<!\\)$(?:(?!^[^\t]).)*'; }
-grepc_mk_v()           { printf '%s\n' '(?s)^'"$1"'\s*[:?+]*=.*?(?<!\\)$'; }
+grepc_mk_r()  { printf '%s\n' '(?s)^(\$\()?'"$1"'\)?\s*:[^=].*?(?<!\\)$(?:(?!^[^\t]).)*'; }
+grepc_mk_v()  { printf '%s\n' '(?s)^'"$1"'\s*[:?+]*=.*?(?<!\\)$'; }
 
 
-               if test "$t_r" = yes;                   then grepc_mk_r "$identifier";                  fi;
-               if test "$t_v" = yes;                   then grepc_mk_v "$identifier";                  fi;
+if test "$t_r" = yes;  then grepc_mk_r "$identifier";  fi;
+if test "$t_v" = yes;  then grepc_mk_v "$identifier";  fi;