summaryrefslogtreecommitdiffstats
path: root/bin/grepc
diff options
context:
space:
mode:
authorAlejandro Colomar <alx.manpages@gmail.com>2022-05-06 02:10:21 +0200
committerAlejandro Colomar <alx.manpages@gmail.com>2022-05-06 02:12:40 +0200
commitbc2e8316d5ddd1646cb85e9433c55cf1b1ab3bea (patch)
tree99043febf4a423a31260677f7688b118a68cf8f7 /bin/grepc
parent4d0dd15ee5878fea3f6b9646b94c7d522a61dd4e (diff)
grepc: Fix parsing of arguments
Allow one single argument only. Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Diffstat (limited to 'bin/grepc')
-rwxr-xr-xbin/grepc37
1 files changed, 19 insertions, 18 deletions
diff --git a/bin/grepc b/bin/grepc
index 0f25370..1eba438 100755
--- a/bin/grepc
+++ b/bin/grepc
@@ -1,6 +1,12 @@
#!/bin/bash
+if (($# != 1)); then
+ >&2 echo "Usage: $0 <identifier>";
+ exit 1;
+fi;
+
+
function grepc_macro_simple()
{
find . -type f \
@@ -25,8 +31,8 @@ function grepc_macro_func()
function grepc_macro()
{
- grepc_macro_simple $1;
- grepc_macro_func $1;
+ grepc_macro_simple "$1";
+ grepc_macro_func "$1";
}
@@ -55,8 +61,8 @@ function grepc_func_def()
function grepc_func()
{
- grepc_func_decl $@;
- grepc_func_def $@;
+ grepc_func_decl "$1";
+ grepc_func_def "$1";
}
@@ -113,30 +119,25 @@ function grepc_type_typedef_underlying_struct_union_enum()
function grepc_type_typedef()
{
- grepc_type_typedef_oneline $1;
- grepc_type_typedef_struct_union_enum $1;
- grepc_type_typedef_underlying_struct_union_enum $1;
+ grepc_type_typedef_oneline "$1";
+ grepc_type_typedef_struct_union_enum "$1";
+ grepc_type_typedef_underlying_struct_union_enum "$1";
}
function grepc_type()
{
- grepc_type_struct_union_enum $1;
- grepc_type_typedef $1;
+ grepc_type_struct_union_enum "$1";
+ grepc_type_typedef "$1";
}
function main()
{
- if (($# != 1)); then
- >&2 echo "Usage: $0 <identifier>";
- return 1;
- fi;
-
- grepc_macro $1;
- grepc_func $1;
- grepc_type $1;
+ grepc_macro "$1";
+ grepc_func "$1";
+ grepc_type "$1";
}
-main $@
+main "$1";