1#!/bin/sh
2# "Distill" PostScript.
3
4# This definition is changed on install to match the
5# executable name set in the makefile
6GS_EXECUTABLE=gs
7gs="`dirname \"$0\"`/$GS_EXECUTABLE"
8if test ! -x "$gs"; then
9	gs="$GS_EXECUTABLE"
10fi
11GS_EXECUTABLE="$gs"
12
13OPTIONS="-P- -dSAFER"
14while true
15do
16	case "$1" in
17	-?*) OPTIONS="$OPTIONS $1" ;;
18	*)  break ;;
19	esac
20	shift
21done
22
23if [ $# -ne 2 ]; then
24	echo "Usage: `basename \"$0\"` [options] input.ps output.ps" 1>&2
25	echo "  e.g. `basename \"$0\"` -sPAPERSIZE=a4 input.ps output.ps" 1>&2
26	exit 1
27fi
28
29exec "$GS_EXECUTABLE" -q -sDEVICE=ps2write -sstdout=%stderr "-sOutputFile=$2" -dNOPAUSE -dBATCH $OPTIONS "$1"
30