summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Colomar <alx@kernel.org>2023-11-02 20:12:31 +0100
committerAlejandro Colomar <alx@kernel.org>2023-11-03 01:08:38 +0100
commit2f020eda8ad58b9bd32ac357fa5ef798124e7a3c (patch)
tree806393bd427c5878f50638f4b75a8e3d5d509883
parent486361da756f0e64b329af06b50e65932095865b (diff)
bin/grepc: Shorten variable names
Also, use names consistent with the command-line option arguments. Signed-off-by: Alejandro Colomar <alx@kernel.org>
-rwxr-xr-xbin/grepc213
1 files changed, 96 insertions, 117 deletions
diff --git a/bin/grepc b/bin/grepc
index dd82839..f6655d3 100755
--- a/bin/grepc
+++ b/bin/grepc
@@ -9,27 +9,27 @@ iflag='';
lflag='';
kflag='no';
tflag='no';
-t_enum='no';
-t_func_proto='no';
-t_func_def='no';
-t_func_syscall_proto='no';
-t_func_syscall_def='no';
-t_func_glibc_proto='no';
-t_func_glibc_libm_def='no';
-t_func_glibc_libio_def='no';
-t_macro_func='no';
-t_macro_obj='no';
-t_type_braced='no';
-t_type_td_simple='no';
-t_type_td_braced='no';
-t_type_td_func='no';
-t_use_enum='no';
-t_use_func_def='no';
-t_use_func_linux_def='no';
-t_use_macro='no';
-t_use_type_su='no';
-t_use_type_td_simple='no';
-t_use_type_td_su='no';
+t_e='no';
+t_fp='no';
+t_fd='no';
+t_fsp='no';
+t_fsd='no';
+t_fgp='no';
+t_fgd_libm='no';
+t_fgd_libio='no';
+t_m_func='no';
+t_m_obj='no';
+t_t_braced='no';
+t_t_td_simple='no';
+t_t_td_braced='no';
+t_t_td_func='no';
+t_ue='no';
+t_uf_def='no';
+t_uf_linux_def='no';
+t_um='no';
+t_ut_su='no';
+t_ut_td_simple='no';
+t_ut_td_su='no';
grepc_err()
@@ -66,78 +66,78 @@ grepc_parse_cmd()
t)
case "$OPTARG" in
e)
- t_enum='yes';
+ t_e='yes';
;;
f)
- t_func_proto='yes';
- t_func_def='yes';
- t_func_syscall_proto='yes';
- t_func_syscall_def='yes';
- t_func_glibc_proto='yes';
- t_func_glibc_libm_def='yes';
- t_func_glibc_libio_def='yes';
+ t_fp='yes';
+ t_fd='yes';
+ t_fsp='yes';
+ t_fsd='yes';
+ t_fgp='yes';
+ t_fgd_libm='yes';
+ t_fgd_libio='yes';
;;
fp)
- t_func_proto='yes';
+ t_fp='yes';
;;
fd)
- t_func_def='yes';
+ t_fd='yes';
;;
fs)
- t_func_syscall_proto='yes';
- t_func_syscall_def='yes';
+ t_fsp='yes';
+ t_fsd='yes';
;;
fsp)
- t_func_syscall_proto='yes';
+ t_fsp='yes';
;;
fsd)
- t_func_syscall_def='yes';
+ t_fsd='yes';
;;
fg)
- t_func_glibc_proto='yes';
- t_func_glibc_libm_def='yes';
- t_func_glibc_libio_def='yes';
+ t_fgp='yes';
+ t_fgd_libm='yes';
+ t_fgd_libio='yes';
;;
fgp)
- t_func_glibc_proto='yes';
+ t_fgp='yes';
;;
fgd)
- t_func_glibc_libm_def='yes';
- t_func_glibc_libio_def='yes';
+ t_fgd_libm='yes';
+ t_fgd_libio='yes';
;;
m)
- t_macro_func='yes';
- t_macro_obj='yes';
+ t_m_func='yes';
+ t_m_obj='yes';
;;
t)
- t_type_braced='yes';
- t_type_td_simple='yes';
- t_type_td_braced='yes';
- t_type_td_func='yes';
+ t_t_braced='yes';
+ t_t_td_simple='yes';
+ t_t_td_braced='yes';
+ t_t_td_func='yes';
;;
u)
- t_use_enum='yes';
- t_use_func_def='yes';
- t_use_func_linux_def='yes';
- t_use_macro='yes';
- t_use_type_su='yes';
- t_use_type_td_simple='yes';
- t_use_type_td_su='yes';
+ t_ue='yes';
+ t_uf_def='yes';
+ t_uf_linux_def='yes';
+ t_um='yes';
+ t_ut_su='yes';
+ t_ut_td_simple='yes';
+ t_ut_td_su='yes';
;;
ue)
- t_use_enum='yes';
+ t_ue='yes';
;;
uf)
- t_use_func_def='yes';
- t_use_func_linux_def='yes';
+ t_uf_def='yes';
+ t_uf_linux_def='yes';
;;
um)
- t_use_macro='yes';
+ t_um='yes';
;;
ut)
- t_use_type_su='yes';
- t_use_type_td_simple='yes';
- t_use_type_td_su='yes';
+ t_ut_su='yes';
+ t_ut_td_simple='yes';
+ t_ut_td_su='yes';
;;
*)
grepc_err "-$opt: $OPTARG: Unknown argument.";
@@ -164,20 +164,20 @@ grepc_parse_cmd()
fi;
if [ "$tflag" = 'no' ]; then
- t_enum='yes';
- t_func_proto='yes';
- t_func_def='yes';
- t_func_syscall_proto='yes';
- t_func_syscall_def='yes';
- t_func_glibc_proto='yes';
- t_func_glibc_libm_def='yes';
- t_func_glibc_libio_def='yes';
- t_macro_func='yes';
- t_macro_obj='yes';
- t_type_braced='yes';
- t_type_td_simple='yes';
- t_type_td_braced='yes';
- t_type_td_func='yes';
+ t_e='yes';
+ t_fp='yes';
+ t_fd='yes';
+ t_fsp='yes';
+ t_fsd='yes';
+ t_fgp='yes';
+ t_fgd_libm='yes';
+ t_fgd_libio='yes';
+ t_m_func='yes';
+ t_m_obj='yes';
+ t_t_braced='yes';
+ t_t_td_simple='yes';
+ t_t_td_braced='yes';
+ t_t_td_func='yes';
fi;
}
@@ -405,48 +405,27 @@ grepc_use_type_td_su()
grepc_search()
{
- test "$t_enum" = 'yes' \
- && grepc_enum_constant "$1";
- test "$t_func_proto" = 'yes' \
- && grepc_func_proto "$1";
- test "$t_func_def" = 'yes' \
- && grepc_func_def "$1";
- test "$t_func_syscall_proto" = 'yes' \
- && grepc_linux_func_syscall_proto "$1";
- test "$t_func_syscall_def" = 'yes' \
- && grepc_linux_func_syscall_def "$1";
- test "$t_func_glibc_proto" = 'yes' \
- && grepc_glibc_func_proto "$1";
- test "$t_func_glibc_libm_def" = 'yes' \
- && grepc_glibc_func_libm_def "$1";
- test "$t_func_glibc_libio_def" = 'yes' \
- && grepc_glibc_func_libio_def "$1";
- test "$t_macro_func" = 'yes' \
- && grepc_macro_func "$1";
- test "$t_macro_obj" = 'yes' \
- && grepc_macro_object "$1";
- test "$t_type_braced" = 'yes' \
- && grepc_type_braced "$1";
- test "$t_type_td_simple" = 'yes' \
- && grepc_type_td_simple "$1";
- test "$t_type_td_braced" = 'yes' \
- && grepc_type_td_braced "$1";
- test "$t_type_td_func" = 'yes' \
- && grepc_type_td_func "$1";
- test "$t_use_enum" = 'yes' \
- && grepc_use_enum "$1";
- test "$t_use_func_def" = 'yes' \
- && grepc_use_func_def "$1";
- test "$t_use_func_linux_def" = 'yes' \
- && grepc_use_func_linux_def "$1";
- test "$t_use_macro" = 'yes' \
- && grepc_use_macro "$1";
- test "$t_use_type_su" = 'yes' \
- && grepc_use_type_su "$1";
- test "$t_use_type_td_simple" = 'yes' \
- && grepc_use_type_td_simple "$1";
- test "$t_use_type_td_su" = 'yes' \
- && grepc_use_type_td_su "$1";
+ test "$t_e" = 'yes' && grepc_enum_constant "$1";
+ test "$t_fp" = 'yes' && grepc_func_proto "$1";
+ test "$t_fd" = 'yes' && grepc_func_def "$1";
+ test "$t_fsp" = 'yes' && grepc_linux_func_syscall_proto "$1";
+ test "$t_fsd" = 'yes' && grepc_linux_func_syscall_def "$1";
+ test "$t_fgp" = 'yes' && grepc_glibc_func_proto "$1";
+ test "$t_fgd_libm" = 'yes' && grepc_glibc_func_libm_def "$1";
+ test "$t_fgd_libio" = 'yes' && grepc_glibc_func_libio_def "$1";
+ test "$t_m_func" = 'yes' && grepc_macro_func "$1";
+ test "$t_m_obj" = 'yes' && grepc_macro_object "$1";
+ test "$t_t_braced" = 'yes' && grepc_type_braced "$1";
+ test "$t_t_td_simple" = 'yes' && grepc_type_td_simple "$1";
+ test "$t_t_td_braced" = 'yes' && grepc_type_td_braced "$1";
+ test "$t_t_td_func" = 'yes' && grepc_type_td_func "$1";
+ test "$t_ue" = 'yes' && grepc_use_enum "$1";
+ test "$t_uf_def" = 'yes' && grepc_use_func_def "$1";
+ test "$t_uf_linux_def" = 'yes' && grepc_use_func_linux_def "$1";
+ test "$t_um" = 'yes' && grepc_use_macro "$1";
+ test "$t_ut_su" = 'yes' && grepc_use_type_su "$1";
+ test "$t_ut_td_simple" = 'yes' && grepc_use_type_td_simple "$1";
+ test "$t_ut_td_su" = 'yes' && grepc_use_type_td_su "$1";
}