musicpal: Drop redundant reset call
[qemu/mdroth.git] / hxtool
blob8f655320be4a76e7eb0a0a9510e3cddb19bf507c
1 #!/bin/sh
3 hxtoh()
5 flag=1
6 while read -r str; do
7 case $str in
8 HXCOMM*)
9 ;;
10 STEXI*|ETEXI*) flag=$(($flag^1))
13 test $flag -eq 1 && printf "%s\n" "$str"
15 esac
16 done
19 hxtotexi()
21 flag=0
22 line=1
23 while read -r str; do
24 case "$str" in
25 HXCOMM*)
27 STEXI*)
28 if test $flag -eq 1 ; then
29 echo "line $line: syntax error: expected ETEXI, found $str" >&2
30 exit 1
32 flag=1
34 ETEXI*)
35 if test $flag -ne 1 ; then
36 echo "line $line: syntax error: expected STEXI, found $str" >&2
37 exit 1
39 flag=0
41 DEFHEADING*)
42 echo "$(expr "$str" : "DEFHEADING(\(.*\))")"
45 test $flag -eq 1 && echo "$str"
47 esac
48 line=$((line+1))
49 done
52 case "$1" in
53 "-h") hxtoh ;;
54 "-t") hxtotexi ;;
55 *) exit 1 ;;
56 esac
58 exit 0