blob: 0fdbc641c643033c8d96028b1b02a5f0e6f9deb4 [file] [log] [blame]
blueswir15824d652009-03-28 06:44:27 +00001#!/bin/sh
2
3hxtoh()
4{
5 flag=1
blueswir1fb21ced2009-03-29 09:06:43 +00006 while read -r str; do
blueswir15824d652009-03-28 06:44:27 +00007 case $str in
8 HXCOMM*)
9 ;;
10 STEXI*|ETEXI*) flag=$(($flag^1))
11 ;;
12 *)
blueswir1004efc92009-03-29 10:50:43 +000013 test $flag -eq 1 && printf "%s\n" "$str"
blueswir15824d652009-03-28 06:44:27 +000014 ;;
15 esac
16 done
17}
18
19hxtotexi()
20{
21 flag=0
blueswir1fb21ced2009-03-29 09:06:43 +000022 while read -r str; do
blueswir15824d652009-03-28 06:44:27 +000023 case "$str" in
24 HXCOMM*)
25 ;;
26 STEXI*|ETEXI*) flag=$(($flag^1))
27 ;;
28 DEFHEADING*)
Stefan Weil7d69c522009-07-01 23:13:34 +020029 echo "$(expr "$str" : "DEFHEADING(\(.*\))")"
blueswir15824d652009-03-28 06:44:27 +000030 ;;
31 *)
Stefan Weil7d69c522009-07-01 23:13:34 +020032 test $flag -eq 1 && echo "$str"
blueswir15824d652009-03-28 06:44:27 +000033 ;;
34 esac
35 done
36}
37
38case "$1" in
39"-h") hxtoh ;;
40"-t") hxtotexi ;;
41*) exit 1 ;;
42esac
blueswir15c2f8d22009-03-28 08:13:56 +000043
44exit 0