%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /bin/
Upload File :
Create Path :
Current File : //bin/foo2hiperc-wrapper

#!/bin/sh

#* Copyright (C) 2003-2006  Rick Richardson
#*
#* This program is free software; you can redistribute it and/or modify
#* it under the terms of the GNU General Public License as published by
#* the Free Software Foundation; either version 2 of the License, or
#* (at your option) any later version.
#*
#* This program is distributed in the hope that it will be useful,
#* but WITHOUT ANY WARRANTY; without even the implied warranty of
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#* GNU General Public License for more details.
#*
#* You should have received a copy of the GNU General Public License
#* along with this program; if not, write to the Free Software
#* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#*
#* Authors: Rick Richardson <rick.richardson@comcast.net>

VERSION='$Id: foo2hiperc-wrapper.in,v 1.34 2013/12/01 20:25:17 rick Exp $'

#
# Printer Notes:
#
# Oki Data C301dn		-z0
# Oki Data C310dn		-z0
# Oki Data C3100		-z0
# Oki Data C3200		-z0
# Oki Data C3300		-z0
# Oki Data C3400		-z0
# Oki Data C5100		-z0
# Oki Data C5250		-z0
# Oki Data C5500		-z0
# Oki Data C5600		-z0
# Oki Data C5800		-z0
# Olivetti d-Color P160W	-z0
# Oki C810			-z1	uses A3/tabloid paper!
#

PROGNAME="$0"
BASENAME=`basename $PROGNAME`
PREFIX=/usr
SHARE=$PREFIX/share/foo2hiperc
PATH=$PATH:/sw/bin:/opt/local/bin
PATH=$PATH:.

#
#	Log the command line, for debugging and problem reports
#
if [ -x /usr/bin/logger -o -x /bin/logger ]; then
    logger -t "$BASENAME" -p lpr.info -- "$BASENAME $@" </dev/null
fi

usage() {
	cat <<EOF
Usage:
	$BASENAME [options] [ps-file]

	Foomatic printer wrapper for the foo2hiperc printer driver.
	This script reads a Postscript ps-file or standard input
	and converts it to a Oki Data HIPERC stream for the
	C310/C3100/C3200/C3250/C3400/C5100/C5250n/C5500/C5600/C5800
	printers.

Normal Options:
-c                Print in color (else monochrome)
-C colormode      Colormode [$COLORMODE]
                    10=ICM color profile (using -G *.icm file)
-d duplex         Duplex code to send to printer [$DUPLEX]
                    1=off, 2=longedge, 3=shortedge
-m media          Media code to send to printer [$MEDIA]
                    0=plain 1=labels 2=transparency
-p paper          Paper code [$PAPER]
                    1=A4, 2=letter, 3=legal, 5=A5, 6=B5, 7=A6, 8=envMonarch,
                    9=envDL, 10=envC5, 11=env#10, 12=executive, 13=env#9,
                    14=legal135, 15=A3, 16=tabloid/ledger
-n copies         Number of copies [$COPIES]
-r <xres>x<yres>  Set device resolution in pixels/inch [$RES]
-s source         Source code to send to printer [$SOURCE]
                    0=auto 1=tray1 2=tray2 3=multi 4=manual
		    Code numbers may vary with printer model.
-t                Draft mode.  Every other pixel is white.
-2/-3/-4/-6/-8/-10/-12/-14/-15/-16/-18
                  Print with N-up (requires psutils)
-o orient         For N-up: -op is portrait, -ol is landscape, -os is seascape.

Printer Tweaking Options:
-u <xoff>x<yoff>  Set offset of upper left printable in pixels [varies]
-l <xoff>x<yoff>  Set offset of lower right printable in pixels [varies]
-L mask           Send logical clipping values from -u/-l in ZjStream [3]
                  0=no, 1=Y, 2=X, 3=XY
-P                Do not output START_PLANE codes.  May be needed by some
                  monochrome-only printers.
-X padlen         Add extra zero padding to the end of BID segments [16]
-z model          Model: 0=no A3 (usual), 1=A3 (C810 etc.) [$MODEL]
-Z compressed     Use uncompressed (0) or compressed (1) data [0]

Color Tweaking Options:
-g gsopts         Additional options to pass to Ghostscript, such as
                  -dDITHERPPI=nnn, etc.  May appear more than once. []
-G profile.icm    Convert profile.icm to a Postscript CRD using icc2ps and
                  adjust colors using the setcolorrendering PS operator.
                  $SHARE/icm/ will be searched for profile.icm.
-I intent         Select profile intent from ICM file [$INTENT]
                  0=Perceptual, 1=Colorimetric, 2=Saturation, 3=Absolute
-G gamma-file.ps  Prepend gamma-file to the Postscript input to perform
                  color correction using the setcolortransfer PS operator.

Debugging Options:
-S plane          Output just a single color plane from a color print [all]
                  1=Cyan, 2=Magenta, 3=Yellow, 4=Black
-D lvl            Set Debug level [$DEBUG]
-V                $VERSION
EOF

	exit 1
}

#
#       Report an error and exit
#
error() {
	echo "$BASENAME: $1" >&2
	exit 1
}

dbgcmd() {
	if [ $DEBUG -ge 1 ]; then
	    echo "$@" >&2
	fi
	"$@"
}

#
#	N-up-ify the job.  Requires psnup from psutils package
#
nup() {
    case "$NUP" in
    [2368]|1[0458])
	tr '\r' '\n' | psnup $NUP_ORIENT -d2 -$NUP -m.3in -p$paper -q
	;;
    [49]|1[26])
	tr '\r' '\n' | psnup $NUP_ORIENT -d2 -$NUP -m.5in -p$paper -q
	;;
    *)
	error "Illegal call to nup()."
	;;
    esac
}

#
#       Process the options
#

# Try to use a local copy of GhostScript 8.54, if available.  Otherwise,
# fallback to whatever the Linux distro has installed (usually 7.07)
#
# N.B. := operator used here, when :- would be better, because "ash"
# doesn't have :-
if eval gs.foo -v >/dev/null 2>&1; then
        GSBIN=${GSBIN:-gs.foo}
else
        GSBIN=${GSBIN:-gs}
fi

CMDLINE="$*"
DEBUG=0
DUPLEX=1
COLOR=
COLORMODE=default
MODEL=0
QUALITY=1
QUALITY=wts
MEDIA=0
COPIES=1
test -r /etc/papersize && PAPER=$(cat /etc/papersize)
test "$PAPER" || PAPER=2
RES=600x600
SOURCE=0
NUP=
CLIP_UL=
CLIP_LR=
CLIP_LOG=
BC=
AIB=
NOPLANES=
COLOR2MONO=
GAMMAFILE=default
INTENT=0
GSOPTS=
EXTRAPAD=
SAVETONER=
NUP_ORIENT=
COMPRESSED=
GSDEV=-sDEVICE=pbmraw
# What mode to use if the user wants us to pick the "best" mode
case `$GSBIN --version` in
7*)	DEFAULTCOLORMODE=10
	DEFAULTCOLORMODE=10
	;;
8.1*)
	DEFAULTCOLORMODE=10
	QUALITY=1
	;;
*)	DEFAULTCOLORMODE=10
	;;
esac
while getopts "1:23456789o:b:cC:d:g:l:u:L:m:n:p:q:r:s:tz:ABS:D:G:I:PX:Z:Vh?" opt
do
	case $opt in
	b)	GSBIN="$OPTARG";;
	c)	COLOR=-c;;
	d)	DUPLEX="$OPTARG";;
	g)	GSOPTS="$GSOPTS $OPTARG";;
	m)	MEDIA="$OPTARG";;
	n)	COPIES="$OPTARG";;
	p)	PAPER="$OPTARG";;
	q)	QUALITY="$OPTARG";;
	r)	RES="$OPTARG";;
	s)	SOURCE="$OPTARG";;
	t)	SAVETONER="-t";;
	z)	MODEL="$OPTARG";;
	l)	CLIP_LR="-l $OPTARG";;
	u)	CLIP_UL="-u $OPTARG";;
	L)	CLIP_LOG="-L $OPTARG";;
	A)	AIB=-A;;
	B)	BC=-B;;
	C)	COLORMODE="$OPTARG";;
	S)	COLOR2MONO="-S$OPTARG";;
	D)	DEBUG="$OPTARG";;
	G)	GAMMAFILE="$OPTARG";;
	I)	INTENT="$OPTARG";;
	P)	NOPLANES=-P;;
	X)	EXTRAPAD="-X $OPTARG";;
	Z)	COMPRESSED="-Z $OPTARG";;
	[234689])	NUP="$opt";;
	[57])	error "Can't find acceptable layout for $opt-up";;
	1)	case "$OPTARG" in
		[024568])	NUP="1$OPTARG";;
		*)	error "Can't find acceptable layout for 1$OPTARG-up";;
		esac
		;;
	o)	case "$OPTARG" in
		l*)	NUP_ORIENT=-l;;
		s*)	NUP_ORIENT=-r;;
		p*|*)	NUP_ORIENT=;;
		esac;;
	V)	echo "$VERSION"; foo2hiperc -V; foo2zjs-pstops -V; exit 0;;
	h|\?)
		if [ "$CMDLINE" != "-?" -a "$CMDLINE" != -h ]; then
		    echo "Illegal command:"
		    echo "	$0 $CMDLINE"
		    echo
		fi
		usage;;
	esac
done
shift `expr $OPTIND - 1`

#
# If there is an argument left, take it as the file to print.
# Else, the input comes from stdin.
#
if [ $# -ge 1 ]; then
    if [ "$LPJOB" = "" ]; then
	: # LPJOB="$1"
    fi
    exec < $1
fi

#
case "$QUALITY" in
0)
    GSOPTS="-dCOLORSCREEN $GSOPTS"
    ;;
1)
    GSOPTS="-dCOLORSCREEN $GSOPTS"
    ;;
2)
    GSOPTS="-dMaxBitmap=500000000 $GSOPTS"
    ;;
as)
    GSOPTS="-dCOLORSCREEN -dMaxBitmap=500000000 $GSOPTS"
    ;;
wts)
    GSOPTS="-dCOLORSCREEN -dMaxBitmap=500000000 $GSOPTS"
    ;;
esac

#
#	Validate model code
#
case "$MODEL" in
0|1)	;;
*)	error "Unknown model code $MODEL";;
esac

#
#	Validate media code
#
case "$MEDIA" in
0|plain)	MEDIA=0;;
1|labels)	MEDIA=1;;
2|transparency)	MEDIA=2;;
[0-9]*)		;;
*)		error "Unknown media code $MEDIA";;
esac

#
#	Validate source (InputSlot) code
#
case "$SOURCE" in
1|tray1)	SOURCE=1;;
2|tray2)	SOURCE=2;;
3|multi)	SOURCE=3;;
4|manual)	SOURCE=4;;
[0-9]*)		;;
*)		error "Unknown source code $SOURCE";;
esac

#
#	Validate Duplex code
#
case "$DUPLEX" in
1|off|none)	DUPLEX=1;;
2|long*)	DUPLEX=2;;
3|short*)	DUPLEX=3;;
[0-9]*)		;;
*)		error "Unknown duplex code $DUPLEX";;
esac

#
#	Validate Resolution
#
case "$RES" in
300x300)	;;
600x600)	;;
1200x600)	;;
1200x1200)	;;
600x1200)	;;
*)		error "Illegal resolution $RES";;
esac

#
#	Figure out the paper dimensions in pixels/inch, and set the
#	default clipping region.  Unfortunately, this is a trouble
#	area for ZjStream printers.  Various versions of ZjS print
#	engines react differently when asked to print into their
#	unprintable regions.
#
set_clipping() {
    ulx=$1; uly=$2
    lrx=$3; lry=$4

    # Set clipping region if it isn't already set
    if [ "$CLIP_UL" = "" ]; then
	case "$RES" in
	300x300)	ulx=`expr $ulx / 4`; uly=`expr $uly / 2`;;
	600x600)	ulx=`expr $ulx / 2`;;
	600x1200)	ulx=`expr $ulx / 2`; uly=`expr $uly \* 2`;;
	2400x600)	ulx=`expr $ulx \* 2`;;
	esac
	CLIP_UL="-u ${ulx}x${uly}"
    fi
    if [ "$CLIP_LR" = "" ]; then
	case "$RES" in
	300x300)	lrx=`expr $lrx / 4`; lry=`expr $lry / 2`;;
	600x600)	lrx=`expr $lrx / 2`;;
	600x1200)	lrx=`expr $lrx / 2`; lry=`expr $lry \* 2`;;
	2400x600)	lrx=`expr $lrx \* 2`;;
	esac
	CLIP_LR="-l ${lrx}x${lry}"
    fi
}

case "$PAPER" in
Custom*x*)
		# Command line only
		XDIM=`echo "$PAPER" | sed -e "s/Custom.//" -e "s/x.*//" `
		YDIM=`echo "$PAPER" | sed -e "s/.*x//" `
		if [ "$XDIM" = "" -o "$YDIM" = "" ]; then
		    error "Custom page size '$PAPER' != 1-99999"
		fi
		if [ "$XDIM" -eq 0 -o "$YDIM" -eq 0 ]; then
		    error "Custom page size '$PAPER' != 1-99999"
		fi
		XDIM=`dc -e "$XDIM 1200* 72/p"`
		YDIM=`dc -e "$YDIM 600* 72/p"`
		PAPER=21;        paper=letter;
                set_clipping 2 100     2 100
		;;
Custom*)
		#%%BeginFeature: *CustomPageSize True
		#216
		#360
		#0
		#0
		#0
		#pop pop pop pop pop

		#%%BeginFeature: *CustomPageSize True
		#792.000000 612.000000 1 0.000000 0.000000
		#pop pop pop pop pop

		if [ $DEBUG = 0 ]; then
		    TMPFILE=/tmp/cus$$
		else
		    TMPFILE=/tmp/custom.ps
		fi
		cat >$TMPFILE
		exec <$TMPFILE

		tmp=`head -n 10000 $TMPFILE \
		    | sed -n '/CustomPageSize/{n;p;n;p;}' \
		    | tr '\n' ' '`
		case "$tmp" in
		[0-9]*\ [0-9]*)
		    XDIM=`echo "$tmp" | sed 's/ .*//'`
		    YDIM=`echo "$tmp" | sed -e 's/^[^ ]* //' -e 's/ .*//'`
		    ;;
		*)
		    if [ $DEBUG = 0 ]; then rm -f $TMPFILE; fi
		    error "Custom page size [XY]DIM != 1-99999"
		    ;;
		esac
		XDIM=`dc -e "$XDIM 1200* 72/p"`
		YDIM=`dc -e "$YDIM 600* 72/p"`
		PAPER=21;        paper=letter;
                set_clipping 2 100     2 100
		;;
1|a4|A4)	PAPER=1;	paper=a4;        XDIM="9920";  YDIM="7016"
		set_clipping 150 100	150 100
		;;
2|letter)	PAPER=2;	paper=letter;    XDIM="10200"; YDIM="6600"
		set_clipping 150 100	150 100
		;;
3|legal)	PAPER=3;	paper=legal;     XDIM="10200"; YDIM="8400"
		set_clipping 150 100	150 100
		;;
5|a5|A5)	PAPER=5;	paper=a5;        XDIM="6992";  YDIM="4960"
		set_clipping 150 100	150 100
		;;
6|b5jis|B5jis)	PAPER=6;	paper=b5;        XDIM="8598";  YDIM="6070"
		set_clipping 150 100	150 100
		;;
7|a6|A6)	PAPER=7;	paper=a6;        XDIM="4960";  YDIM="3496"
		set_clipping 150 100	150 100
		;;
8|envMonarch)	PAPER=8;	paper=envMonarch;XDIM="4650";  YDIM="4500"
		set_clipping 150 100	150 100
		;;
9|envDL)	PAPER=9;	paper=envDL;     XDIM="5200";  YDIM="5200"
		set_clipping 150 100	150 100
		;;
10|envC5)	PAPER=10;	paper=envC5;     XDIM="7650";  YDIM="5408"
		set_clipping 150 100	150 100
		;;
11|"env#10")	PAPER=11;	paper=env10;     XDIM="4950";  YDIM="5700"
		set_clipping 150 100	150 100
		;;
12|executive)	PAPER=12;	paper=executive; XDIM="8700";  YDIM="6300"
		set_clipping 150 100	150 100
		;;
13|"env#9")	PAPER=13;	paper=env9;      XDIM="4496";  YDIM="5324"
		set_clipping 150 100	150 100
		;;
14|legal135)	PAPER=14;	paper=legal135;  XDIM="10200"; YDIM="8100"
		set_clipping 150 100	150 100
		;;
15|a3|A3)	PAPER=15;	paper=a3;        XDIM="19842"; YDIM="7016"
		set_clipping 150 100	150 100
		;;
16|ledger|tabloid)
		PAPER=16;	paper=tabloid;   XDIM="20400"; YDIM="6600"
		set_clipping 150 100	150 100
		;;
*)		error "Unimplemented paper code $PAPER";;
esac
# e.g. /usr/share/ghostscript/7.07/lib/gs_statd.ps
PAPERSIZE="-sPAPERSIZE=$paper";

case "$RES" in
300x300)	XDIM=`expr $XDIM / 4`; YDIM=`expr $YDIM / 2`;;
600x600)	XDIM=`expr $XDIM / 2`;;
1200x600)	;;
1200x1200)	YDIM=`expr $YDIM \* 2`;;
600x1200)	XDIM=`expr $XDIM / 2`; YDIM=`expr $YDIM \* 2`;;
esac

ROTATE90=0
case "$MODEL" in
1)	# A3 or 11x17 printer
    case "$paper" in
    a3)			# A3, do not rotate
	;;
    ledger|tabloid)	# ledger, do not rotate
	;;
    *)	# Rotate all others
	ROTATE90=1
        tmp=$XDIM
	XDIM=$YDIM
	YDIM=$tmp
	case "$RES" in
	600x600)        YDIMpoints=`dc -e "6k $YDIM 600 / 72 *p"`;;
	1200x600)       YDIMpoints=`dc -e "6k $YDIM 1200 / 72 *p"`;;
	2400x600)       YDIMpoints=`dc -e "6k $YDIM 2400 / 72 *p"`;;
	esac
    esac
    ;;
esac

DIM="${XDIM}x${YDIM}"

#
# Filter thru psnup if N-up printing has been requested
#
case $NUP in
[234689]|1[024568])	PREFILTER="nup";;
*)			PREFILTER=cat;;
esac
if [ "$DEBUG" -ge 9 ]; then
    PREFILTER="tee /tmp/$BASENAME.ps"
fi

#
#	Overload -G.  If the file name ends with ".icm" or ".ICM"
#	then convert the ICC color profile to a Postscript CRD,
#	then prepend it to the users job.  Select the intent
#	using the -I option.
#

create_crd() {
    #
    # Create a Postscript CRD
    #
    ICC2PS=$PREFIX/bin/foo2zjs-icc2ps
    if [ -x $ICC2PS ]; then
	case "$GAMMAFILE" in
	none | none.icm | */none.icm)
	    ;;
	*)
	    if [ -x /usr/bin/logger ]; then
		logger -t "$BASENAME" -p lpr.info -- \
		"`basename $ICC2PS` -o $GAMMAFILE -t$INTENT > $ICCTMP.crd.ps"
	    fi
	    $ICC2PS -o $GAMMAFILE -t$INTENT > $ICCTMP.crd.ps 2>$ICCTMP.log \
		|| error "Problem converting .ICM file to Postscript"
	    ;;
	esac

	PSTOPS_OPTS="$PSTOPS_OPTS -c"
	cat > $ICCTMP.usecie.ps <<-EOF
		%!PS-Adobe-3.0
		<</UseCIEColor true>>setpagedevice
	EOF
	if [ "$QUALITY" = wts -o "$QUALITY" = as ]; then
	    if [ "$QUALITY" = wts ]; then
		cat >> $ICCTMP.usecie.ps <<-EOF
		    << /UseWTS true >> setuserparams
		EOF
	    else
		cat >> $ICCTMP.usecie.ps <<-EOF
		    << /UseWTS false >> setuserparams
		EOF
	    fi
	    cat >> $ICCTMP.usecie.ps <<-EOF
		<<
		    /AccurateScreens true
		    /HalftoneType 1
		    /HalftoneName (Round Dot Screen) cvn
		    /SpotFunction { 180 mul cos exch 180 mul cos add 2 div}
		    /Frequency 137
		    /Angle 37
		>> sethalftone
		EOF
	fi
	cat > $ICCTMP.selcrd.ps <<-EOF
		/Current /ColorRendering findresource setcolorrendering
	EOF
	case "$GAMMAFILE" in
	none | none.icm | */none.icm) GAMMAFILE="$ICCTMP.usecie.ps";;
	*)	GAMMAFILE="$ICCTMP.usecie.ps $ICCTMP.crd.ps $ICCTMP.selcrd.ps";;
	esac
    else
	GAMMAFILE=
    fi
}

if [ $DEBUG -gt 0 ]; then
    ICCTMP=/tmp/icc
else
    ICCTMP=/tmp/icc$$
fi

if [ "" = "$COLOR" ]; then
    COLORMODE=
    GAMMAFILE=
else
    case "$COLORMODE" in
    default)	COLORMODE=$DEFAULTCOLORMODE;;
    esac
    case "$GAMMAFILE" in
    default)	GAMMAFILE=samclp300-0.icm;;
    esac
fi

CRDBASE="$PREFIX/share/foo2hiperc/crd"
if false; then
    case "$MODEL" in
	0)	model=CLP-300;;
	1)	model=CLP-600;;
    esac
    case "$RES" in
	600x600)	SCREEN=$model-600x600cms2;;
	1200x600)	SCREEN=$model-1200x600cms2;;
	1200x1200)	SCREEN=$model-1200x1200cms2;;
    esac
fi

PSTOPS_OPTS="-n"
if [ $ROTATE90 = 1 ]; then
    case $paper in
    a3)		;;
    ledger)	;;
    tabloid)	;;
    *)		PSTOPS_OPTS="$PSTOPS_OPTS -h $YDIMpoints -r";;
    esac
fi

case "$COLORMODE" in
0|"")
    # Monochrome
    ;;
10|icm)
    # Use old ICM method
    AIB=-A
    BC=-B
    case "$GAMMAFILE" in
    none | none.icm | */none.icm)
	create_crd
	;;
    *.icm|*.ICM|*.icc|*.ICC)
	#
	# Its really an .ICM file, not a gamma file.
	#
	# The file can be a full path name, or the name of a file in $SHARE/icm/
	#
	if [ -r "$GAMMAFILE" ]; then
	    create_crd
	elif [ -r "$SHARE/icm/$GAMMAFILE" ]; then
	    GAMMAFILE="$SHARE/icm/$GAMMAFILE"
	    create_crd
	else
	    GAMMAFILE=
	fi
	;;
    esac
    ;;
1|crd)
    # CRD
    GAMMAFILE=""
    GAMMAFILE="$GAMMAFILE $CRDBASE/${model}cms"
    GAMMAFILE="$GAMMAFILE $CRDBASE/$SCREEN"
    ;;
*.crd)
    GAMMAFILE="$CRDBASE/prolog.ps"
    if [ -f $COLORMODE ]; then
	GAMMAFILE="$GAMMAFILE $COLORMODE"
    elif [ -f $CRDBASE/$COLORMODE ]; then
	GAMMAFILE="$GAMMAFILE $CRDBASE/$COLORMODE"
    else
	error "Can't find CRD '$COLORMODE' in . or in $CRDBASE"
    fi
    GAMMAFILE="$GAMMAFILE $CRDBASE/$SCREEN"
    ;;
*)
    error "Unknown color method '$COLORMODE'"
    ;;
esac

if [ "$COLOR" != "" -a "$QUALITY" = wts ]; then
    PSTOPS_OPTS="$PSTOPS_OPTS -w"
elif [ "$COLOR" != "" -a "$QUALITY" = as ]; then
    PSTOPS_OPTS="$PSTOPS_OPTS -a"
fi

if [ "" != "$COLOR" ]; then
    if [ "" = "$AIB" -a "" = "$BC" ]; then
	# Faster, but can't handle AllIsBlack or BlackClears
	GSDEV=-sDEVICE=pksmraw
    else
	# Can't handle different size pages
	GSDEV=-sDEVICE=bitcmyk
    fi
fi

#
#	Figure out USERNAME
#
if [ "$LPUSER" != "" ]; then
    USER="$LPUSER@$LPHOST"
else
    USER=""
fi

#
#	Main Program, just cobble together the pipeline and run it
#
#	The malarky with file descriptors 1 and 3 is to avoid a bug in
#	(some versions?) of Ghostscript where Postscript's stdout gets
#	intermingled with the printer drivers output, resulting in
#	corrupted image data.
#
GS="$GSBIN -q -dBATCH -dSAFER -dQUIET -dNOPAUSE -dNOINTERPOLATE"

foo2zjs-pstops $PSTOPS_OPTS | \
$PREFILTER \
| ($GS $PAPERSIZE -g$DIM -r$RES $GSDEV $GSOPTS \
    -sOutputFile="|cat 1>&3" $GAMMAFILE -_ >/dev/null) 3>&1 \
| foo2hiperc -r$RES -g$DIM -p$PAPER -m$MEDIA -n$COPIES -d$DUPLEX -s$SOURCE \
	    $COLOR $CLIP_UL $CLIP_LR $CLIP_LOG $SAVETONER \
	    -J "$LPJOB" -U "$USER" \
	    $BC $AIB $COLOR2MONO $NOPLANES $EXTRAPAD $COMPRESSED -D$DEBUG

#
#	Log the command line, for debugging and problem reports
#
if [ -x /usr/bin/logger ]; then
    logger -t "$BASENAME" -p lpr.info -- \
	"$GSBIN $PAPERSIZE -g$DIM -r$RES $GSDEV $GSOPTS $GAMMAFILE"
    logger -t "$BASENAME" -p lpr.info -- \
	"foo2hiperc -r$RES -g$DIM -p$PAPER -m$MEDIA \
-n$COPIES -d$DUPLEX -s$SOURCE $COLOR $CLIP_UL $CLIP_LR $CLIP_LOG \
$SAVETONER $BC $AIB $COLOR2MONO $NOPLANES $EXTRAPAD $COMPRESSED"
fi

#
#	Remove cruft
#
if [ $DEBUG -eq 0 ]; then
    for i in crd.ps log usecie.ps selcrd.ps
    do
	file="$ICCTMP.$i"
	[ -f $file ] && rm -f $file
    done
    [ -f "$TMPFILE" ] && rm -f $TMPFILE
    [ -f "$TMPFILE2" ] && rm -f $TMPFILE2
fi

exit 0

Zerion Mini Shell 1.0