Skip to content

Commit e2574c6

Browse files
committed
ocaml-link.sh.in: Remove redundant use of getopt
Also allow --cclib as an alternative, and improved error reporting when parsing the parameters to the script. Fixes: #16 Reported-by: Mohamed Akram (cherry picked from libguestfs commit 4d5fe341c7d5daf8006fb58aad23cb9f579f3e88)
1 parent 755bf63 commit e2574c6

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

ocaml-link.sh.in

+4-6
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,16 @@
2828
# Pass the cclib argument separately, and the rest as separated
2929
# arguments.
3030

31-
TEMP=`getopt -a -o '' --long 'cclib:' \
32-
-n "$(basename $0)" -- "$@"`
33-
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
34-
eval set -- "$TEMP"
35-
3631
cclib=
3732

3833
while true ; do
3934
case "$1" in
4035
-cclib|--cclib) cclib="$2" ; shift 2 ;;
36+
-cclib=*|--cclib=*) cclib="${1#*=}"; shift 1 ;;
4137
--) shift ; break ;;
42-
*) echo "Internal error!" ; exit 1 ;;
38+
*)
39+
printf >&2 "usage: %s [-cclib lib] -- arg ...\n" "$(basename "$0")"
40+
exit 2 ;;
4341
esac
4442
done
4543

0 commit comments

Comments
 (0)