[PATCH modular] Catch bad command-line arguments.

Trevor Woerner twoerner at gmail.com
Fri Oct 1 18:54:21 PDT 2010


From: Trevor Woerner <twoerner at gmail.com>

If the user specifies unknown, misspelled, or too many cmdline arguments
make sure to catch them and generate an error.

Signed-off-by: Trevor Woerner <twoerner at gmail.com>
---

NOTE: this patch to be applied after the 10 I sent yesterday!

 build.sh |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/build.sh b/build.sh
index 6c63cc5..6c76a5c 100755
--- a/build.sh
+++ b/build.sh
@@ -897,6 +897,7 @@ HAVE_ARCH="`uname -i`"
 DIR_ARCH=""
 DIR_CONFIG="."
 LIB_ONLY=0
+PREFIX=""
 
 # Process command line args
 while [ $# != 0 ]
@@ -984,6 +985,14 @@ do
 	fi
 	;;
     *)
+	if [ X"$PREFIX" != X ]; then
+	    echo "unrecognized and/or too many command-line arguments"
+	    echo "  new PREFIX:      $1"
+	    echo "  existing PREFIX: $PREFIX"
+	    echo ""
+	    usage
+	    exit 1
+	fi
 	PREFIX=$1
 	;;
     esac
-- 
1.7.3.1.45.g9855b



More information about the xorg-devel mailing list