aboutsummaryrefslogtreecommitdiff
path: root/scripts/hxtool
diff options
context:
space:
mode:
authorDaniel Shahaf <danielsh@apache.org>2016-10-16 17:28:18 +0300
committerMichael Tokarev <mjt@tls.msk.ru>2016-10-28 18:17:23 +0300
commit5a1de0b325c9c3df41cb41bcea8dca5fafc67b9a (patch)
treeb32a45e4b1051a0ae2bcdd92defb98c0641db3f9 /scripts/hxtool
parente1f3b974f46a15da038f3612bf1858ec81db793d (diff)
downloadqemu-5a1de0b325c9c3df41cb41bcea8dca5fafc67b9a.zip
qemu-5a1de0b325c9c3df41cb41bcea8dca5fafc67b9a.tar.gz
qemu-5a1de0b325c9c3df41cb41bcea8dca5fafc67b9a.tar.bz2
scripts/hxtool: fix undefined behavour of echo
Avoid undefined behaviour of echo(1) with backslashes in arguments The behaviour is implementation-defined, different /bin/sh's behave differently. Signed-off-by: Daniel Shahaf <danielsh@apache.org> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Diffstat (limited to 'scripts/hxtool')
-rw-r--r--scripts/hxtool20
1 files changed, 10 insertions, 10 deletions
diff --git a/scripts/hxtool b/scripts/hxtool
index 995bb7f..04f7d7b 100644
--- a/scripts/hxtool
+++ b/scripts/hxtool
@@ -26,32 +26,32 @@ hxtotexi()
;;
STEXI*)
if test $flag -eq 1 ; then
- echo "line $line: syntax error: expected ETEXI, found $str" >&2
+ printf "line %d: syntax error: expected ETEXI, found '%s'\n" "$line" "$str" >&2
exit 1
fi
flag=1
;;
ETEXI*)
if test $flag -ne 1 ; then
- echo "line $line: syntax error: expected STEXI, found $str" >&2
+ printf "line %d: syntax error: expected STEXI, found '%s'\n" "$line" "$str" >&2
exit 1
fi
flag=0
;;
SQMP*|EQMP*)
if test $flag -eq 1 ; then
- echo "line $line: syntax error: expected ETEXI, found $str" >&2
+ printf "line %d: syntax error: expected ETEXI, found '%s'\n" "$line" "$str" >&2
exit 1
fi
;;
DEFHEADING*)
- echo "$(expr "$str" : "DEFHEADING(\(.*\))")"
+ printf '%s\n' "$(expr "$str" : "DEFHEADING(\(.*\))")"
;;
ARCHHEADING*)
- echo "$(expr "$str" : "ARCHHEADING(\(.*\),.*)")"
+ printf '%s\n' "$(expr "$str" : "ARCHHEADING(\(.*\),.*)")"
;;
*)
- test $flag -eq 1 && echo "$str"
+ test $flag -eq 1 && printf '%s\n' "$str"
;;
esac
line=$((line+1))
@@ -69,26 +69,26 @@ hxtoqmp()
;;
SQMP*)
if test $flag -eq 1 ; then
- echo "line $line: syntax error: expected EQMP, found $str" >&2
+ printf "line %d: syntax error: expected EQMP, found '%s'\n" "$line" "$str" >&2
exit 1
fi
flag=1
;;
EQMP*)
if test $flag -ne 1 ; then
- echo "line $line: syntax error: expected SQMP, found $str" >&2
+ printf "line %d: syntax error: expected SQMP, found '%s'\n" "$line" "$str" >&2
exit 1
fi
flag=0
;;
STEXI*|ETEXI*)
if test $flag -eq 1 ; then
- echo "line $line: syntax error: expected EQMP, found $str" >&2
+ printf "line %d: syntax error: expected EQMP, found '%s'\n" "$line" "$str" >&2
exit 1
fi
;;
*)
- test $flag -eq 1 && echo "$str"
+ test $flag -eq 1 && printf '%s\n' "$str"
;;
esac
line=$((line+1))