root / hxtool @ 16415335
History | View | Annotate | Download (720 Bytes)
1 |
#!/bin/sh |
---|---|
2 |
|
3 |
hxtoh() |
4 |
{ |
5 |
flag=1 |
6 |
while read -r str; do |
7 |
case $str in |
8 |
HXCOMM*) |
9 |
;; |
10 |
STEXI*|ETEXI*) flag=$(($flag^1)) |
11 |
;; |
12 |
*) |
13 |
test $flag -eq 1 && printf "%s\n" "$str" |
14 |
;; |
15 |
esac |
16 |
done |
17 |
} |
18 |
|
19 |
hxtotexi() |
20 |
{ |
21 |
flag=0 |
22 |
while read -r str; do |
23 |
case "$str" in |
24 |
HXCOMM*) |
25 |
;; |
26 |
STEXI*|ETEXI*) flag=$(($flag^1)) |
27 |
;; |
28 |
DEFHEADING*) |
29 |
echo "$(expr "$str" : "DEFHEADING(\(.*\))")" |
30 |
;; |
31 |
*) |
32 |
test $flag -eq 1 && echo "$str" |
33 |
;; |
34 |
esac |
35 |
done |
36 |
} |
37 |
|
38 |
case "$1" in |
39 |
"-h") hxtoh ;; |
40 |
"-t") hxtotexi ;; |
41 |
*) exit 1 ;; |
42 |
esac |
43 |
|
44 |
exit 0 |