You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.2 KiB

1 month ago
  1. #!/bin/sh
  2. # Revised in 2020 to use the eps2write device (within ps2epsi.ps)
  3. # This definition is changed on install to match the
  4. # executable name set in the makefile, but we check a couple of other
  5. # places (bin/ sibling to $LIBDIR and 'gs' on the $PATH)
  6. GS_EXECUTABLE=gs
  7. LIBDIR=`dirname $0`
  8. gs="$LIBDIR/$GS_EXECUTABLE"
  9. if test ! -x "$gs"; then
  10. # Might be executing lib/ps2epsi with bin/ as sibling to lib/
  11. gs="$LIBDIR/../bin/$GS_EXECUTABLE"
  12. if test ! -x "$gs"; then
  13. # Fallback to using any 'gs' on the path
  14. gs="$GS_EXECUTABLE"
  15. fi
  16. fi
  17. GS_EXECUTABLE="$gs"
  18. export outfile
  19. if [ $# -lt 1 -o $# -gt 2 ]; then
  20. echo "Usage: `basename \"$0\"` file.ps [file.epsi]" 1>&2
  21. exit 1
  22. fi
  23. infile=$1;
  24. if [ $# -eq 1 ]; then
  25. case "${infile}" in
  26. *.ps) base=`basename "${infile}" .ps` ;;
  27. *.cps) base=`basename "${infile}" .cps` ;;
  28. *.eps) base=`basename "${infile}" .eps` ;;
  29. *.epsf) base=`basename "${infile}" .epsf` ;;
  30. *) base=`basename "${infile}"` ;;
  31. esac
  32. outfile=${base}.epsi
  33. else
  34. outfile=$2
  35. fi
  36. # Note, we expect 'ps2epsi.ps' to be on one of the search paths which can be seen by: gs -h
  37. "$GS_EXECUTABLE" -q -dNOOUTERSAVE -dNODISPLAY -dLastPage=1 -sOutputFile="${outfile}" \
  38. --permit-file-all="${infile}" -- ps2epsi.ps "${infile}" 1>&2
  39. exit 0