From: Trevor Woerner <[email protected]> Switch to using a standard command-line parsing tool: getopt. Hopefully this will help catch discrepancies between the usage screen and the options that are accepted and ensure required arguments are accounted for.
Signed-off-by: Trevor Woerner <[email protected]> --- build.sh | 18 +++++++++++++++--- 1 files changed, 15 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index 9e74c28..e766fa5 100755 --- a/build.sh +++ b/build.sh @@ -762,8 +762,14 @@ DIR_CONFIG="." LIB_ONLY=0 # Process command line args -while test $# != 0; do - case $1 in +CMDLINE=`getopt -o abcdDf:ghlno:pr:s:L --long clone,autoresume:,check,help -n $0 -- "$@"` +if test $? != 0; then + echo "getopt invocation error" + exit 1 +fi +eval set -- "$CMDLINE" +while true; do + case "$1" in -a) NOAUTOGEN=1 ;; @@ -829,13 +835,19 @@ while test $# != 0; do -L) LISTONLY=1 ;; + --) + shift + break + ;; *) - PREFIX=$1 + echo "internal getopt error!" + exit 1 ;; esac shift done +PREFIX=$* if test x"${PREFIX}" = x && test -z "$LISTONLY"; then usage -- 1.7.1 _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
