From: Taylor R Campbell Date: Sat, 15 Apr 2017 18:55:48 +0000 (+0000) Subject: Splice shell arguments with ${1+"$@"}. X-Git-Tag: mit-scheme-pucked-9.2.12~158^2~44 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=355ea65eb2326fe050875864660497be74cc6b75;p=mit-scheme.git Splice shell arguments with ${1+"$@"}. Leave as "${@}" only where it is absolutely obvious there must be at least one parameter anyway, e.g. because it is a full command line. --- diff --git a/src/Setup.sh b/src/Setup.sh index 8ace433d1..e35dddf86 100755 --- a/src/Setup.sh +++ b/src/Setup.sh @@ -102,5 +102,5 @@ maybe_link config.guess microcode/config.guess for SUBDIR in ${INSTALLED_SUBDIRS} ${OTHER_SUBDIRS}; do echo "setting up ${SUBDIR}" maybe_link ${SUBDIR}/Setup.sh ../etc/Setup.sh - (cd ${SUBDIR} && ./Setup.sh ${@:+"${@}"}) + (cd ${SUBDIR} && ./Setup.sh ${1+"$@"}) done diff --git a/src/blowfish/tags-fix.sh b/src/blowfish/tags-fix.sh index c2823ad7f..14e5e8636 100755 --- a/src/blowfish/tags-fix.sh +++ b/src/blowfish/tags-fix.sh @@ -5,7 +5,7 @@ set -e : ${MIT_SCHEME_EXE=mit-scheme} -${MIT_SCHEME_EXE} --batch-mode -- "${@}" <<\EOF +${MIT_SCHEME_EXE} --batch-mode -- ${1+"$@"} <<\EOF (let ((name (car (command-line)))) (let ((shim.c-prefix (string-append name "-shim.c,")) (const.c-prefix (string-append name "-const.c,"))) diff --git a/src/compiler/Setup.sh b/src/compiler/Setup.sh index 23e2ef883..712b9cba2 100755 --- a/src/compiler/Setup.sh +++ b/src/compiler/Setup.sh @@ -29,4 +29,4 @@ set -eu . ../etc/functions.sh -../etc/Setup.sh ${@:+"${@}"} +../etc/Setup.sh ${1+"$@"} diff --git a/src/etc/c-bundle.sh b/src/etc/c-bundle.sh index 60e50f39e..bfdb71d60 100755 --- a/src/etc/c-bundle.sh +++ b/src/etc/c-bundle.sh @@ -43,7 +43,7 @@ shift 3 GEN_NONCE=${AUXDIR}/gen-nonce EXTRACT_DECLS=${AUXDIR}/extract-liarc-decls -"${EXTRACT_DECLS}" "${@}" > "${SYSTEM}.h" +"${EXTRACT_DECLS}" ${1+"$@"} > "${SYSTEM}.h" cat < "${SYSTEM}.c" diff --git a/src/etc/functions.sh b/src/etc/functions.sh index c6a0173ed..a4256d166 100644 --- a/src/etc/functions.sh +++ b/src/etc/functions.sh @@ -32,12 +32,12 @@ run_cmd () run_configure () { - run_cmd ./configure "${@}" + run_cmd ./configure ${1+"$@"} } run_make () { - run_cmd make "${@}" + run_cmd make ${1+"$@"} } run_cmd_in_dir () @@ -102,7 +102,7 @@ maybe_rm () { FILES= DIRS= - for FN in "${@}"; do + for FN in ${1+"$@"}; do if [ -L "${FN}" ]; then : elif [ -f "${FN}" ]; then diff --git a/src/etc/macosx/mit-scheme.sh b/src/etc/macosx/mit-scheme.sh index 3408f8cfa..452ef0575 100755 --- a/src/etc/macosx/mit-scheme.sh +++ b/src/etc/macosx/mit-scheme.sh @@ -1,2 +1,2 @@ #!/bin/bash -exec /Applications/MIT\:GNU\ Scheme.app/Contents/Resources/mit-scheme "${@}" +exec /Applications/MIT\:GNU\ Scheme.app/Contents/Resources/mit-scheme ${1+"$@"} diff --git a/src/etc/make-in-subdirs.sh b/src/etc/make-in-subdirs.sh index d0fd8ec4f..60133e7f4 100755 --- a/src/etc/make-in-subdirs.sh +++ b/src/etc/make-in-subdirs.sh @@ -28,6 +28,6 @@ set -e TARGET=${1} shift -for SUBDIR in "${@}"; do +for SUBDIR in ${1+"$@"}; do run_cmd_in_dir "${SUBDIR}" make "${TARGET}" done diff --git a/src/etc/make-liarc-dist.sh b/src/etc/make-liarc-dist.sh index 28fc0cd95..784489d1c 100755 --- a/src/etc/make-liarc-dist.sh +++ b/src/etc/make-liarc-dist.sh @@ -30,5 +30,5 @@ set -e export MIT_SCHEME_EXE run_cmd ./Setup.sh -run_configure --enable-native-code=c "${@}" +run_configure --enable-native-code=c ${1+"$@"} run_make liarc-dist diff --git a/src/etc/make-liarc.sh b/src/etc/make-liarc.sh index b57e89280..922282b1e 100755 --- a/src/etc/make-liarc.sh +++ b/src/etc/make-liarc.sh @@ -27,7 +27,7 @@ set -e . etc/functions.sh FASTP=no -for ARG in "${@}"; do +for ARG in ${1+"$@"}; do case ${ARG} in --help|--help=*|--version) FASTP=yes @@ -36,7 +36,7 @@ for ARG in "${@}"; do done if [ ${FASTP} = yes ]; then - exec ./configure "${@}" + exec ./configure ${1+"$@"} fi if [ ! -f runtime/runtime-unx.c ]; then @@ -55,5 +55,5 @@ run_configure --prefix=`pwd`/boot-root --enable-native-code=c \ --disable-host-scheme-test run_make stamp_install-liarc-boot-compiler c-clean distclean -run_configure --enable-native-code=c --disable-host-scheme-test "${@}" +run_configure --enable-native-code=c --disable-host-scheme-test ${1+"$@"} run_make stamp_compile-liarc-bundles build-bands clean-boot-root diff --git a/src/etc/make-native.sh b/src/etc/make-native.sh index 8721e0c18..e9c86852f 100755 --- a/src/etc/make-native.sh +++ b/src/etc/make-native.sh @@ -28,7 +28,7 @@ set -e FASTP=no NATIVE_CODE= -for ARG in "${@}"; do +for ARG in ${1+"$@"}; do case ${ARG} in --help|--help=*|--version) FASTP=yes @@ -40,7 +40,7 @@ for ARG in "${@}"; do done if [ ${FASTP} = yes ]; then - exec ./configure "${@}" + exec ./configure ${1+"$@"} fi : ${MIT_SCHEME_EXE:=mit-scheme-c} @@ -112,5 +112,5 @@ EOF run_make stamp_install-native-boot-compiler c-clean distclean -run_configure "${@}" +run_configure ${1+"$@"} run_make stamp_native-compile-scheme build-bands clean-boot-root diff --git a/src/gdbm/tags-fix.sh b/src/gdbm/tags-fix.sh index c2823ad7f..14e5e8636 100755 --- a/src/gdbm/tags-fix.sh +++ b/src/gdbm/tags-fix.sh @@ -5,7 +5,7 @@ set -e : ${MIT_SCHEME_EXE=mit-scheme} -${MIT_SCHEME_EXE} --batch-mode -- "${@}" <<\EOF +${MIT_SCHEME_EXE} --batch-mode -- ${1+"$@"} <<\EOF (let ((name (car (command-line)))) (let ((shim.c-prefix (string-append name "-shim.c,")) (const.c-prefix (string-append name "-const.c,"))) diff --git a/src/mcrypt/tags-fix.sh b/src/mcrypt/tags-fix.sh index c2823ad7f..14e5e8636 100755 --- a/src/mcrypt/tags-fix.sh +++ b/src/mcrypt/tags-fix.sh @@ -5,7 +5,7 @@ set -e : ${MIT_SCHEME_EXE=mit-scheme} -${MIT_SCHEME_EXE} --batch-mode -- "${@}" <<\EOF +${MIT_SCHEME_EXE} --batch-mode -- ${1+"$@"} <<\EOF (let ((name (car (command-line)))) (let ((shim.c-prefix (string-append name "-shim.c,")) (const.c-prefix (string-append name "-const.c,"))) diff --git a/src/md5/tags-fix.sh b/src/md5/tags-fix.sh index c2823ad7f..14e5e8636 100755 --- a/src/md5/tags-fix.sh +++ b/src/md5/tags-fix.sh @@ -5,7 +5,7 @@ set -e : ${MIT_SCHEME_EXE=mit-scheme} -${MIT_SCHEME_EXE} --batch-mode -- "${@}" <<\EOF +${MIT_SCHEME_EXE} --batch-mode -- ${1+"$@"} <<\EOF (let ((name (car (command-line)))) (let ((shim.c-prefix (string-append name "-shim.c,")) (const.c-prefix (string-append name "-const.c,"))) diff --git a/src/mhash/tags-fix.sh b/src/mhash/tags-fix.sh index c2823ad7f..14e5e8636 100755 --- a/src/mhash/tags-fix.sh +++ b/src/mhash/tags-fix.sh @@ -5,7 +5,7 @@ set -e : ${MIT_SCHEME_EXE=mit-scheme} -${MIT_SCHEME_EXE} --batch-mode -- "${@}" <<\EOF +${MIT_SCHEME_EXE} --batch-mode -- ${1+"$@"} <<\EOF (let ((name (car (command-line)))) (let ((shim.c-prefix (string-append name "-shim.c,")) (const.c-prefix (string-append name "-const.c,"))) diff --git a/src/microcode/Setup.sh b/src/microcode/Setup.sh index 1af18c3d1..98212eabd 100755 --- a/src/microcode/Setup.sh +++ b/src/microcode/Setup.sh @@ -58,9 +58,9 @@ if [ ! -x configure ]; then autoconf autoconf=done fi -( cd cmpauxmd && make ${@:+"${@}"} ) +( cd cmpauxmd && make ${1+"$@"} ) if [ ! -f Makefile.in ]; then makeinit=clean - makegen/makeinit.sh ${@:+"${@}"} + makegen/makeinit.sh ${1+"$@"} makeinit=done fi diff --git a/src/microcode/makegen/makeinit.sh b/src/microcode/makegen/makeinit.sh index d9ca21e1a..96b2eb633 100755 --- a/src/microcode/makegen/makeinit.sh +++ b/src/microcode/makegen/makeinit.sh @@ -42,7 +42,7 @@ trap clean EXIT INT TERM # Generate "config.h". touch Makefile.in -./configure --disable-native-code ${@:-"${@}"} || exit $? +./configure --disable-native-code ${1+"$@"} || exit $? # Generate the real "Makefile.in" from "Makefile.in.in". Requires # "config.h", because dependencies are generated by running GCC -M on diff --git a/src/x11/tags-fix.sh b/src/x11/tags-fix.sh index c2823ad7f..14e5e8636 100755 --- a/src/x11/tags-fix.sh +++ b/src/x11/tags-fix.sh @@ -5,7 +5,7 @@ set -e : ${MIT_SCHEME_EXE=mit-scheme} -${MIT_SCHEME_EXE} --batch-mode -- "${@}" <<\EOF +${MIT_SCHEME_EXE} --batch-mode -- ${1+"$@"} <<\EOF (let ((name (car (command-line)))) (let ((shim.c-prefix (string-append name "-shim.c,")) (const.c-prefix (string-append name "-const.c,")))