Imported from antiword-0.30.tar.gz.
[antiword.git] / Unix-only / KDE-only / kantiword.sh
blobd99c6f50a941da3b754bca5ab0ccc5db73ce0ef3
1 #!/bin/sh
3 # Script to make drag and drop in KDE possible
4 #set -x
7 if [ $# -lt 2 ]
8 then
9 exit 0
12 # Determine the temp directory
13 if [ -d "$TMPDIR" ] && [ -w "$TMPDIR" ]
14 then
15 tmp_dir=$TMPDIR
16 elif [ -d "$TEMP" ] && [ -w "$TEMP" ]
17 then
18 tmp_dir=$TEMP
19 else
20 tmp_dir="/tmp"
21 fi
22 out_file=$tmp_dir"/antiword.$$.ps"
23 err_file=$tmp_dir"/antiword.$$.err"
25 # Determine the paper size
26 paper_size=$1
27 shift
29 # Make the PostScript file
30 antiword -p $paper_size "$@" 2>$err_file >$out_file
31 if [ $? -ne 0 ]
32 then
33 rm -f $out_file
34 exit 1
37 # Show the PostScript file
38 gv $out_file -nocentre -media $paper_size
40 # Clean up
41 rm -f $out_file $err_file
42 exit 0