Debian Codegraph @

lib/ps2epsi

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