home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / anwor032.zip / antiword.0.32 / Unix-only / KDE2-only / kantiword.sh < prev    next >
Linux/UNIX/POSIX Shell Script  |  2001-07-08  |  830b  |  49 lines

  1. #!/bin/sh
  2. #
  3. # Script to make drag and drop in KDE possible
  4. #set -x
  5. #
  6.  
  7. if [ $# -lt 2 ]
  8. then
  9.     exit 0
  10. fi
  11.  
  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"
  24.  
  25. # Determine the paper size
  26. paper_size=$1
  27. shift
  28.  
  29. # Make the PostScript file
  30. antiword -p $paper_size -i 0 "$@" 2>$err_file >$out_file
  31. if [ $? -ne 0 ]
  32. then
  33.     # Something went wrong
  34.     if [ -r "$err_file" ] && [ -s "$err_file" ]
  35.     then
  36.         konsole --caption "Error from Antword" -e less $err_file
  37.     fi
  38.     # Clean up
  39.     rm -f $out_file $err_file
  40.     exit 1
  41. fi
  42.  
  43. # Show the PostScript file
  44. gv $out_file -nocentre -media $paper_size
  45.  
  46. # Clean up
  47. rm -f $out_file $err_file
  48. exit 0
  49.