Skip to content

Commit

Permalink
Merge pull request libretro#8229 from orbea/qb
Browse files Browse the repository at this point in the history
qb: Check number of arguments for while loops.
  • Loading branch information
inactive123 authored Feb 8, 2019
2 parents 3b19fa9 + 7cd6c9c commit 8936972
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions qb/qb.libs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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'
Expand Down
4 changes: 3 additions & 1 deletion qb/qb.params.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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#*=}";;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 8936972

Please sign in to comment.