diff options
-rwxr-xr-x | functions/arguments.sh | 11 | ||||
-rwxr-xr-x | scripts/build/config | 11 |
2 files changed, 15 insertions, 7 deletions
diff --git a/functions/arguments.sh b/functions/arguments.sh index b2089626c..6b3a5d117 100755 --- a/functions/arguments.sh +++ b/functions/arguments.sh @@ -10,11 +10,14 @@ Arguments () { - ARGUMENTS="$(getopt --longoptions breakpoints,color,conffile:,debug,force,help,quiet,usage,verbose,version --name=${PROGRAM} --options c:huv --shell sh -- "${@}")" + local ERR=0 + ARGUMENTS="$(getopt --longoptions breakpoints,color,conffile:,debug,force,help,quiet,usage,verbose,version --name=${PROGRAM} --options c:huv --shell sh -- "${@}")" || ERR=$? - if [ $? -ne 0 ] - then - Echo_error "terminating" >&2 + if [ $ERR -eq 1 ]; then + Echo_error "invalid arguments" + exit 1 + elif [ $ERR -ne 0 ]; then + Echo_error "getop failure" exit 1 fi diff --git a/scripts/build/config b/scripts/build/config index ce4a24542..b30223457 100755 --- a/scripts/build/config +++ b/scripts/build/config @@ -164,10 +164,15 @@ Local_arguments () bootstrap-qemu-exclude:" # Remove spaces added by indentation LONG_OPTIONS="$(echo ${LONG_OPTIONS} | tr -d ' ')" - ARGUMENTS="$(getopt --longoptions ${LONG_OPTIONS} --name="${PROGRAM}" --options a:d:m:k:b:s:c:huv --shell sh -- "${@}")" - if [ $? -ne 0 ]; then - Echo_error "terminating" >&2 + local ERR=0 + ARGUMENTS="$(getopt --longoptions ${LONG_OPTIONS} --name="${PROGRAM}" --options a:d:m:k:b:s:c:huv --shell sh -- "${@}")" || ERR=$? + + if [ $ERR -eq 1 ]; then + Echo_error "invalid arguments" + exit 1 + elif [ $ERR -ne 0 ]; then + Echo_error "getop failure" exit 1 fi |