net/rocker: Cleanup the useless return value check
[qemu/kevin.git] / scripts / hxtool
blob5468cd77826dfb51696b01540f33207080b6ee20
1 #!/bin/sh
3 hxtoh()
5 flag=1
6 while read -r str; do
7 case $str in
8 HXCOMM*)
9 ;;
10 STEXI*|ETEXI*|SQMP*|EQMP*) flag=$(($flag^1))
13 test $flag -eq 1 && printf "%s\n" "$str"
15 esac
16 done
19 print_texi_heading()
21 if test "$*" != ""; then
22 printf "@subsection %s\n" "$*"
26 hxtotexi()
28 flag=0
29 line=1
30 while read -r str; do
31 case "$str" in
32 HXCOMM*)
34 STEXI*)
35 if test $flag -eq 1 ; then
36 printf "line %d: syntax error: expected ETEXI, found '%s'\n" "$line" "$str" >&2
37 exit 1
39 flag=1
41 ETEXI*)
42 if test $flag -ne 1 ; then
43 printf "line %d: syntax error: expected STEXI, found '%s'\n" "$line" "$str" >&2
44 exit 1
46 flag=0
48 SQMP*|EQMP*)
49 if test $flag -eq 1 ; then
50 printf "line %d: syntax error: expected ETEXI, found '%s'\n" "$line" "$str" >&2
51 exit 1
54 DEFHEADING*)
55 print_texi_heading "$(expr "$str" : "DEFHEADING(\(.*\))")"
57 ARCHHEADING*)
58 print_texi_heading "$(expr "$str" : "ARCHHEADING(\(.*\),.*)")"
61 test $flag -eq 1 && printf '%s\n' "$str"
63 esac
64 line=$((line+1))
65 done
68 hxtoqmp()
70 IFS=
71 flag=0
72 line=1
73 while read -r str; do
74 case "$str" in
75 HXCOMM*)
77 SQMP*)
78 if test $flag -eq 1 ; then
79 printf "line %d: syntax error: expected EQMP, found '%s'\n" "$line" "$str" >&2
80 exit 1
82 flag=1
84 EQMP*)
85 if test $flag -ne 1 ; then
86 printf "line %d: syntax error: expected SQMP, found '%s'\n" "$line" "$str" >&2
87 exit 1
89 flag=0
91 STEXI*|ETEXI*)
92 if test $flag -eq 1 ; then
93 printf "line %d: syntax error: expected EQMP, found '%s'\n" "$line" "$str" >&2
94 exit 1
98 test $flag -eq 1 && printf '%s\n' "$str"
100 esac
101 line=$((line+1))
102 done
105 case "$1" in
106 "-h") hxtoh ;;
107 "-t") hxtotexi ;;
108 "-q") hxtoqmp ;;
109 *) exit 1 ;;
110 esac
112 exit 0