Simplify search criterion and add an error check.
Signed-off-by: Garrett Cooper <yanegomi@gmail.com>
diff --git a/testcases/open_posix_testsuite/scripts/locate-test b/testcases/open_posix_testsuite/scripts/locate-test
index e18642c..834354b 100755
--- a/testcases/open_posix_testsuite/scripts/locate-test
+++ b/testcases/open_posix_testsuite/scripts/locate-test
@@ -36,20 +36,18 @@
EOF
}
-buildable="";
-execs=""
-print_execs=0
+buildable=
+execs=
# Go through the cmd line options
while true
do
case "$1" in
"--buildable")
- buildable="( -name [0-9]*-*.c ! -name [0-9]*-[0-9]*.sh )"
+ buildable="-name [0-9]*-*.c"
shift
;;
"--execs")
- print_execs=1
execs="( ( -name [0-9]*-[0-9]*.c -o -name [0-9]*-[0-9]*.sh ) -a ! -name *-buildonly* )"
shift
;;
@@ -58,7 +56,7 @@
exit 0
;;
--*)
- echo >&2 "Unknown option $1"
+ echo >&2 "Unknown option: $1"
usage >&2
exit 1
;;
@@ -77,21 +75,10 @@
echo >&2 "Error: no root directory specified"
usage >&2
exit 1
+elif [ "x$buildable" = x -a "x$execs" = x ]; then
+ echo >&2 "Error: no options specified"
+ usage >&2
+ exit 1
fi
-# Force something .c or .sh
-# Avoid .o, backups
-# IF --execs, force it has no "-buildonly"
-# If --buildable, remove the .sh files
-find "$WHERE" -type f \
- \( \
- \( -name "[0-9]*-*.c" -o -name "[0-9]*-[0-9]*.sh" \) \
- ! -name \*.o ! -name \*~ \
- \) \
- $buildable $execs | \
- if [ $print_execs -eq 1 ]
- then
- sed 's/\.\(sh\|c\)$/.test/'
- else
- cat
- fi
+find "$WHERE" -type f $buildable $execs