Merge pull request #8229 from orbea/qb

qb: Check number of arguments for while loops.
This commit is contained in:
Twinaphex 2019-02-08 21:20:42 +01:00 committed by GitHub
commit 8936972ba2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -16,7 +16,7 @@ add_define()
# $@ = include or library paths
add_dirs()
{ ADD="$1"; LINK="${1%"${1#?}"}"; shift
while [ "$1" ]; do
while [ $# -gt 0 ]; do
eval "${ADD}_DIRS=\"\${${ADD}_DIRS} -${LINK}${1}\""
shift
done
@ -292,7 +292,7 @@ create_config_header()
{ printf %s\\n "#ifndef $name" "#define $name" '' \
"#define PACKAGE_NAME \"$PACKAGE_NAME\""
while [ "$1" ]; do
while [ $# -gt 0 ]; do
case "$(eval "printf %s \"\$HAVE_$1\"")" in
'yes')
n='0'
@ -361,7 +361,7 @@ create_config_make()
"BUILD = $BUILD" \
"PREFIX = $PREFIX"
while [ "$1" ]; do
while [ $# -gt 0 ]; do
case "$(eval "printf %s \"\$HAVE_$1\"")" in
'yes')
n='0'

View File

@ -73,7 +73,7 @@ parse_input() # Parse stuff :V
#OPTS contains all available options in config.params.sh - used to speedup
#things in opt_exists()
while [ "$1" ]; do
while [ $# -gt 0 ]; do
case "$1" in
--prefix=*) PREFIX=${1##--prefix=};;
--global-config-dir=*|--sysconfdir=*) GLOBAL_CONFIG_DIR="${1#*=}";;
@ -101,6 +101,8 @@ parse_input() # Parse stuff :V
eval "$opt=\"$val\""
;;
-h|--help) print_help; exit 0;;
--) break ;;
'') : ;;
*) die 1 "Unknown option $1";;
esac
shift