diff --git a/scripts/hxtool b/scripts/hxtool index 80516b9437..51dc841479 100755 --- a/scripts/hxtool +++ b/scripts/hxtool @@ -2,15 +2,29 @@ hxtoh() { - flag=1 + in_rst=0 while read -r str; do case $str in HXCOMM*) ;; - SRST*|ERST*) flag=$(($flag^1)) + SRST*) + if [ $in_rst -eq 1 ] + then + echo "Error: SRST inside another RST" >&2 + exit 1 + fi + in_rst=1 + ;; + ERST*) + if [ $in_rst -eq 0 ] + then + echo "Error: ERST already outside RST" >&2 + exit 1 + fi + in_rst=0 ;; *) - test $flag -eq 1 && printf "%s\n" "$str" + test $in_rst -eq 0 && printf "%s\n" "$str" ;; esac done