[PATCH build 2/4] Use getopt(1) to parse command-line.
Trevor Woerner
twoerner at gmail.com
Thu Sep 16 19:16:45 PDT 2010
From: Trevor Woerner <twoerner at gmail.com>
Switch to using a standard command-line parsing tool: getopt(1).
Signed-off-by: Trevor Woerner <twoerner at gmail.com>
Acked-by: Peter Hutterer <peter.hutterer at who-t.net>
Acked-by: Gaetan Nadon <memsize at videotron.ca>
---
build.sh | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/build.sh b/build.sh
index 003b765..024750d 100755
--- a/build.sh
+++ b/build.sh
@@ -750,8 +750,13 @@ DIR_CONFIG="."
LIB_ONLY=0
# Process command line args
-while [ $# != 0 ]
-do
+CMDLINE=`getopt -o abcdDf:ghlno:pr:s:L --long check,clone,help,autoresume: -n $0 -- "$@"`
+if [ $? != 0 ]; then
+ echo "getopt(1) invocation error"
+ exit 1
+fi
+eval set -- "$CMDLINE"
+while [ 1 ]; do
case $1 in
-a)
NOAUTOGEN=1
@@ -818,13 +823,19 @@ do
-L)
LISTONLY=1
;;
+ --)
+ shift
+ break
+ ;;
*)
- PREFIX=$1
+ echo "internal getopt(1) error!"
+ exit 1
;;
esac
shift
done
+PREFIX=$1
if [ -z "${PREFIX}" ] && [ -z "$LISTONLY" ]; then
usage
--
1.7.3.rc2
More information about the xorg-devel
mailing list