summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2018-11-21 19:04:44 (EST)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2018-11-21 19:10:22 (EST)
commitd643f7726b47ee1ea4913811ac5a72bab2a22830 (patch)
tree89a679f1d399c1a7dd6ed89fe8daa3d705d71019
parente4ccb5e50b0d40ffca12eabdd6c4d9cd40e7f851 (diff)
tools/shld.sh: Use parameters, not global variables
-rwxr-xr-xtools/shld.sh19
1 files changed, 13 insertions, 6 deletions
diff --git a/tools/shld.sh b/tools/shld.sh
index 2a5587c..41751d3 100755
--- a/tools/shld.sh
+++ b/tools/shld.sh
@@ -21,11 +21,6 @@ set -u
VERSION='0.2.0'
-output='out.sh'
-make_executable=false
-interpreter='/bin/sh'
-entry_point='main'
-
die()
{
local fmt="${1}"
@@ -37,6 +32,11 @@ die()
link()
{
+ local make_executable="${1}"
+ local interpreter="${2}"
+ local entry_point="${3}"
+ local output="${4}"
+ shift 4
local input=
# Open output file.
@@ -123,6 +123,12 @@ EOF
main()
{
+ local opt=
+ local make_executable=false
+ local interpreter='/bin/sh'
+ local entry_point='main'
+ local output='out.sh'
+
while getopts 'hVI:e:o:' opt; do
case "${opt}" in
'h')
@@ -153,7 +159,8 @@ main()
exit 1
fi
- link "${@}"
+ link "${make_executable}" "${interpreter}" "${entry_point}" \
+ "${output}" "${@}"
}
main "${@}"