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
}
args=`getopt r: $*`
if [ $? -ne 0 ]; then
usage
fi
set -- $args
REVISION=
while true; do
case "$1" in
-r)
REVISION="-r $2"
shift; shift
while getopts r: opt; do
case $opt in
r)
REVISION="-r $OPTARG"
;;
--)
shift; break
\?)
usage
;;
esac
done
shift $(($OPTIND - 1))
if [ $# -lt 2 ]; then
usage