aboutsummaryrefslogtreecommitdiff
path: root/extract-function.sh
diff options
context:
space:
mode:
authorGravatar Andres Erbsen <andreser@mit.edu>2017-06-18 17:04:48 -0400
committerGravatar Andres Erbsen <andreser@mit.edu>2017-06-18 17:04:48 -0400
commite966c5ac810c7214b3f25c9f8ff7b965c0174f51 (patch)
treec05daafea9845ad1ff46c61dc3a444b5fd7e21ad /extract-function.sh
parent6d375335db79c5a50a929e03f3a0be2578f6cf49 (diff)
sh portability fixes in "make c"
Diffstat (limited to 'extract-function.sh')
-rwxr-xr-xextract-function.sh7
1 files changed, 5 insertions, 2 deletions
diff --git a/extract-function.sh b/extract-function.sh
index 4056f242c..c2deef7f2 100755
--- a/extract-function.sh
+++ b/extract-function.sh
@@ -1,4 +1,7 @@
#!/bin/sh
+set -e || true
+set -u || true
+set -o pipefail || true
case "$#" in
0)
@@ -46,7 +49,7 @@ while IFS= read -r line; do
sed 's:return::g' | sed 's:Return::g' | tr -d '(' | tr -d ')' | tr , '\n' | sed 's/^\s\+//g' | \
( while IFS= read -r ret; do
echo "out[$i] = $ret;"
- ((i++))
+ i=$((i+1))
done;
seq 2 "$lines" | while IFS= read -r _; do
echo -n "}"
@@ -59,7 +62,7 @@ while IFS= read -r line; do
*)
case "$show" in
true)
- ((lines++))
+ lines=$((lines+1))
echo "{ $line" | \
sed s':^\([^,]*\) \([^, ]*\)\(\s*\),\(.*\)\(addcarryx.*\))\([; ]*\)$:\1 \2\3;\4_\5, \&\2)\6:' | \
sed s':^\([^,]*\) \([^, ]*\)\(\s*\),\(.*\)\(subborrow.*\))\([; ]*\)$:\1 \2\3;\4_\5, \&\2)\6:'