#!/bin/sh # @(#)clipr.ifc.sh 1.4 11/8/94 . lmpaths #CLPRDEBUG=yes CLPRDEBUG= export CLPRDEBUG if [ "$CLPRDEBUG" ] then echo >/tmp/${CLIPR_CMD_NAME}.out chmod 666 /tmp/${CLIPR_CMD_NAME}.out debugmsg () { echo `date '+%H:%M:%S %d %b %y'`: ${CLIPR_IFC_NAME}: "$*" >>/tmp/${CLIPR_CMD_NAME}.out } else debugmsg () { : } fi # The printer name is the installed name of this script. # The name of the client machine to which the printer is attached defaults # to the printer name, but may be overridden by a "CLIENT=name" near the top # of this file. # Similarly, the name of the share area to which the client should link to # pick up the print job defaults to the (possibly overridden) client name. # It too may be changed by a "CLSHARE=name" near the top of this file. MODEL=$CLIPR_STD_PATH JOBNAME=job debugmsg Input parm zero is ${0} debugmsg Input parm one is ${1} debugmsg Input parm two is ${2} debugmsg Input parm three is ${3} debugmsg Input parm four is ${4} debugmsg Input parm five is ${5} debugmsg CLSHARE is ${CLSHARE} debugmsg CLIENT is ${CLIENT} Printer=`basename $0` # our invoked name debugmsg Printer is $Printer FILE=$CLIPRDIR_PATH/$Printer/$JOBNAME debugmsg FILE is $FILE Options=$5 # passed in options. our filter needs them # These defaults never happen... # Client name defaults to the printer name : ${CLIENT:=$Printer} # CLSHARE defaults to client name : ${CLSHARE:=$CLIENT} if [ ! -d "$CLIPRDIR_PATH" ] then $LPDISABLE_PATH -r"The directory $CLIPRDIR_PATH does not exist" $Printer exit 1 fi if [ ! -f "$MODEL" ] # if we can't find our copy... then if [ "$HAVE_UNAME_R" != '' ] then UVER=`uname -r|cut -d. -f1` else UVER=$UNAME_OSVERSION fi if [ "$UVER" = "4" ] then MODEL=$SVR4_STD_MODEL_PATH if [ ! -f "$MODEL" ] # if we can't find their copy... then $LPDISABLE_PATH -r"Cannot execute $MODEL" $Printer exit 2 fi else MODEL=$SVR3_STD_MODEL_PATH if [ ! -f "$MODEL" ] # if we can't find their copy... then $LPDISABLE_PATH -r"Cannot execute $MODEL" $Printer exit 2 fi fi fi if [ ! -w "$FILE" ] then $LPDISABLE_PATH -r"Cannot write in $FILE" $Printer exit 4 fi # Invoke the standard model script, passing it our "filter" as the tail # end of any filtering that gets done. Our "filter" makes the job # disappear into the client machine. # If present, then use the "LASTFILTER" variable, to make sure we're # at the end of the chain # If not, then formfeeds might not work, since we'll bypass the # LPPAGER program used by MODEL to put them in if a printer doesn't # support them. MYFILT="$CLIPR_FLT_PATH \ $CLIPR_CMD_PATH $CLIENT $JOBNAME $CLSHARE $Printer \"$Options\" " if grep LASTFILTER $MODEL >$DEV_NULL_PATH 2>&1 then LASTFILTER="| $MYFILT" debugmsg LASTFILTER is $LASTFILTER else if [ "$FILTER" ] then FILTER="( $FILTER | $MYFILT )" else FILTER="( $MYFILT )" fi debugmsg FILTER is $FILTER fi debugmsg exec line is $MODEL "$x1" "$x2" "$x3" "$x4" "$x5" "$@" # Invoke standard model script with FILE as stdout, replacing the device. # Null parameters don't get passed correctly if not passed explicitly. # It's in the sh(1) man page. ("Implicit null arguments...are removed.") exec 1>$FILE x1=$1; x2=$2; x3=$3; x4=$4; x5=$5 shift 5 set -- "$x1" "$x2" "$x3" "$x4" "$x5" "$@" . $MODEL exit $?