Tim Waugh 7bf6f0
#!/bin/sh
Tim Waugh 7bf6f0
#
Tim Waugh 7bf6f0
# CUPS filter script for Ghostscript.
Tim Waugh 7bf6f0
#
Tim Waugh 7bf6f0
# Copyright 2001-2002 by Easy Software Products.
Tim Waugh 7bf6f0
# Copyright 2006 by Hewlett-Packard Development Company, L.P.
Tim Waugh 7bf6f0
#
Tim Waugh 7bf6f0
# This program is free software; you can redistribute it and/or modify
Tim Waugh 7bf6f0
# it under the terms of the GNU General Public License as published by
Tim Waugh 7bf6f0
# the Free Software Foundation; either version 2, or (at your option)
Tim Waugh 7bf6f0
# any later version.
Tim Waugh 7bf6f0
#
Tim Waugh 7bf6f0
# This program is distributed in the hope that it will be useful,
Tim Waugh 7bf6f0
# but WITHOUT ANY WARRANTY; without even the implied warranty of
Tim Waugh 7bf6f0
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Tim Waugh 7bf6f0
# GNU General Public License for more details.
Tim Waugh 7bf6f0
#
Tim Waugh 7bf6f0
# You should have received a copy of the GNU General Public License
Tim Waugh 7bf6f0
# along with this program; if not, write to the Free Software
Tim Waugh 7bf6f0
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Tim Waugh 7bf6f0
#
Tim Waugh 7bf6f0
Tim Waugh 7bf6f0
# Installation directories...
Tim Waugh 7bf6f0
prefix=/usr
Tim Waugh 7bf6f0
exec_prefix=${prefix}
Tim Waugh 7bf6f0
bindir=${exec_prefix}/bin
Tim Waugh 7bf6f0
Tim Waugh 7bf6f0
# Set the library/font path...
Tim Waugh 7bf6f0
GS_FONTPATH="$CUPS_FONTPATH"
Tim Waugh 7bf6f0
export GS_FONTPATH
Tim Waugh 7bf6f0
Tim Waugh 7bf6f0
# Options we use with Ghostscript...
Tim Waugh 7bf6f0
gsopts="-dQUIET -dDEBUG -dPARANOIDSAFER -dNOPAUSE -dBATCH "
Tim Waugh 7bf6f0
gsopts="$gsopts -dNOMEDIAATTRS -sDEVICE=pdfwrite -sstdout=%stderr"
Tim Waugh 7bf6f0
Tim Waugh 7bf6f0
# See if we have a profile=n,n,n,n,n,n,n,n,n,n,n option...
Tim Waugh 7bf6f0
profile=""
Tim Waugh 7bf6f0
for option in $5; do
Tim Waugh 7bf6f0
    case $option in
Tim Waugh 7bf6f0
        profile=*)
Tim Waugh 7bf6f0
	    profile="-scupsProfile=`echo $option | awk -F= '{print $2}'`"
Tim Waugh 7bf6f0
	    ;;
Tim Waugh 7bf6f0
    esac
Tim Waugh 7bf6f0
done
Tim Waugh 7bf6f0
Tim Waugh 7bf6f0
# See if we have a filename on the command-line...
Tim Waugh 7bf6f0
if test -z "$6"; then
Tim Waugh 7bf6f0
	ifile="-"
Tim Waugh 7bf6f0
else
Tim Waugh 7bf6f0
	ifile="$6"
Tim Waugh 7bf6f0
fi
Tim Waugh 7bf6f0
Tim Waugh 7bf6f0
# Now run Ghostscript...
Tim Waugh 7bf6f0
$bindir/gs $gsopts -sOUTPUTFILE="%stdout" $profile $ifile
Tim Waugh 7bf6f0