]> git.lizzy.rs Git - plan9front.git/blob - rc/bin/doc2txt
git: fix non-interruptible temporary warning
[plan9front.git] / rc / bin / doc2txt
1 #!/bin/rc
2
3 rfork en
4
5 if(! ~ $#* 0 1) {
6         echo 'usage: doc2txt [file.doc]' >[1=2]
7         exit usage
8 }
9
10 switch($#*){
11 case 0
12         cat >/tmp/doc2txt.$pid
13         file=/tmp/doc2txt.$pid
14 case 1
15         file=$1
16 }
17 aux/olefs $file || { 
18         echo 'doc2txt: couldn''t mount word document' >[1=2]
19         rm -f /tmp/doc2txt.$pid
20         exit word
21 }
22
23 if(! test -f /mnt/doc/WordDocument) {
24         echo 'doc2txt: is an msoffice doc but not a word document' >[1=2]
25         rm -f /tmp/doc2txt.$pid
26         exit worddoc
27 }
28
29 aux/mswordstrings /mnt/doc/WordDocument | tcs -f microsoft -t utf |fmt  | uniq
30 unmount /mnt/doc
31 rm -f /tmp/doc2txt.$pid