home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / anwor032.zip / antiword.0.32 / kantiword.exe < prev    next >
Text File  |  2001-10-21  |  841b  |  50 lines

  1. #!/bin/sh
  2. #!/bin/sh
  3. #
  4. # Script to make drag and drop in KDE possible
  5. #set -x
  6. #
  7.  
  8. if [ $# -lt 2 ]
  9. then
  10.     exit 0
  11. fi
  12.  
  13. # Determine the temp directory
  14. if [ -d "$TMPDIR" ] && [ -w "$TMPDIR" ]
  15. then
  16.     tmp_dir=$TMPDIR
  17. elif [ -d "$TEMP" ] && [ -w "$TEMP" ]
  18. then
  19.     tmp_dir=$TEMP
  20. else
  21.     tmp_dir="/tmp"
  22. fi                        
  23. out_file=$tmp_dir"/antiword.$$.ps"
  24. err_file=$tmp_dir"/antiword.$$.err"
  25.  
  26. # Determine the paper size
  27. paper_size=$1
  28. shift
  29.  
  30. # Make the PostScript file
  31. antiword -p $paper_size -i 0 "$@" 2>$err_file >$out_file
  32. if [ $? -ne 0 ]
  33. then
  34.     # Something went wrong
  35.     if [ -r "$err_file" ] && [ -s "$err_file" ]
  36.     then
  37.         konsole --caption "Error from Antword" -e less $err_file
  38.     fi
  39.     # Clean up
  40.     rm -f $out_file $err_file
  41.     exit 1
  42. fi
  43.  
  44. # Show the PostScript file
  45. gv $out_file -nocentre -media $paper_size
  46.  
  47. # Clean up
  48. rm -f $out_file $err_file
  49. exit 0
  50.