Use getopts instead of getopt(1).

Suggested by:	jilles
This commit is contained in:
Gleb Smirnoff 2012-01-15 09:27:00 +00:00
parent d6ba7d93ba
commit 4347075067
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=230128

View File

@ -27,23 +27,18 @@ usage()
exit 1 exit 1
} }
args=`getopt r: $*`
if [ $? -ne 0 ]; then
usage
fi
set -- $args
REVISION= REVISION=
while true; do while getopts r: opt; do
case "$1" in case $opt in
-r) r)
REVISION="-r $2" REVISION="-r $OPTARG"
shift; shift
;; ;;
--) \?)
shift; break usage
;; ;;
esac esac
done done
shift $(($OPTIND - 1))
if [ $# -lt 2 ]; then if [ $# -lt 2 ]; then
usage usage