summaryrefslogtreecommitdiffstats
path: root/tools/shld.sh
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:04:44 (EST)
commit5f61f497e98fdf12591bfe19461ed5e27706cd01 (patch)
tree2835afb39f45593eb5648082f04ad15b5815fe74 /tools/shld.sh
parent522be3b9fe7c471906990de3a2ab939d95070e64 (diff)
tools/shld.sh: Use parameters, not global variables
Diffstat (limited to 'tools/shld.sh')
-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 "${@}"