#bin/sh/ ############################################################################# # # Copyright (c) 1998 Canon USA, Inc. All Rights Reserved # # End standard header ####################################################### # # File: @(#)canoniface 1.1 02/15/02 # # Description: # # Interface script for Canon network printers. # ############################################################################# # 08/28/03 RB - Modified for Canon 5200i on HP-UX 11i ########### ## ## Standard printer interface program. ## ########### ##### # # Until we get to the point below where the printer port # and physical printer are initialized, we can't do much # except exit if the Spooler/Scheduler cancels us. ##### trap 'exit' 15 ##### # # We can be clever about getting a hangup or interrupt, though, at least # until the filter runs. Do this early, even though $LPTELL # isn't defined, so that we're covered. ##### catch_hangup () { if [ -n "${LPTELL}" ] then echo \ "The connection to the printer dropped; perhaps the printer went off-line?" \ | ${LPTELL} ${printer} fi return 0 } catch_interrupt () { if [ -n "${LPTELL}" ] then echo \ "Received an interrupt from the printer. The reason is unknown, although a common cause is that the baud rate is too high." \ | ${LPTELL} ${printer} fi return 0 } trap 'catch_hangup; exit_code=129 exit 129' 1 trap 'catch_interrupt; exit_code=129 exit 129' 2 3 ##### # # Function to initialize debug. # ##### dbginit () { dbgfile=/tmp/${1}.log guilog=/tmp/${1}.gpgui.log /usr/bin/cat /dev/null > $dbgfile /usr/bin/chmod 666 $dbgfile } ##### # # Function conditionally write debug messages. Only arg is message to # put in the file. # ##### dbgout () { if [ X${dbgfile} != X"" ]; then /bin/echo "" >> $dbgfile /bin/echo "$1" >> $dbgfile /bin/echo "" >> $dbgfile fi } ##### # # Most of the time we don't want the standard error to be captured # by the Spooler, mainly to avoid "Terminated" messages that the # shell puts out when we get a SIGTERM. We'll save the standard # error channel under another number, so we can use it when it # should be captured. # # Open another channel to the printer port, for use when the # regular standard output won't be directed there, such as in # command substitution (`cmd`). ##### #exec 5>&2 2>/dev/null 3>&1 ##### # # Set some globally used variables and functions. # ##### MODEL=ir5020 CHKD=ckdisplay TMPDIR=/tmp : ${SPOOLDIR:=/usr/spool/lp} : ${LOCALPATH:=${SPOOLDIR}/bin} PATH="/bin:/usr/bin:${LOCALPATH}" ##### # Use ${TMPPREFIX} as the prefix for all temporary files, so # that cleanup is easy. The prefix may be up to 13 characters # long, so you only have space for one more character to make # a file name. If necessary, make a directory using this prefix # for better management of unique temporary file names. ##### TMPPREFIX=${TMPDIR}/`uname -n`$$ ##### # Before exiting, set ${exit_code} to the value with which to exit. # Otherwise, the exit from this script will be 0. ##### trap 'rm -fr ${TMPPREFIX}; exit ${exit_code}' 0 mkdir ${TMPPREFIX} ##### # ${LPTELL} is the name of a program that will send its # standard input to the Spooler. It is used to forward # the description of a printer fault to the Spooler, # which uses it in an alert to the administrator. ##### if [ ! -x "${LPTELL:=${LOCALPATH}/lp.tell}" ] then fake_lptell () { header="no" while read line do if [ "no" = "${header}" ] then errmsg ERROR ${E_IP_UNKNOWN} \ "unknown printer/interface failure" \ "consult your system administrator; reasons for failure (if any) follow:" header=yes fi echo "${line}" >&2 done return 1 } LPTELL=fake_lptell fi ##### # Error message formatter: # # Invoke as # # errmsg severity message-number problem help # # where severity is "ERROR" or "WARNING", message-number is # a unique identifier, problem is a short description of the # problem, and help is a short suggestion for fixing the problem. ##### LP_ERR_LABEL="UX:lp" E_IP_ARGS=1 E_IP_OPTS=2 #E_IP_FILTER=3 E_IP_STTY=4 E_IP_UNKNOWN=5 E_IP_BADFILE=6 E_IP_BADCHARSET=7 E_IP_BADCPI=8 E_IP_BADLPI=9 E_IP_BADWIDTH=10 E_IP_BADLENGTH=11 E_IP_ERRORS=12 # (in slow.filter) errmsg () { case $1 in ERROR ) sev=" ERROR"; ;; WARNING ) sev="WARNING"; ;; esac echo "${LP_ERR_LABEL}: ${sev}: $3 TO FIX: $4" >&5 } # # Function to copy the files to temporary files. The function uses $files # for the original list of files, and produces $newfiles. This function # deals with copying files with the same basename to the same directory. # copyfiles () { i=0 for j in ${files} do # Only do this if the file exists and is readable. We # could easily error out here if that is better behavior if [ -r "$j" ] then tmp=`basename "$j"` newfile="${TMPPREFIX}/${tmp}.${i}" cp $j $newfile # FILTERS CAN BE PLACED HERE AND FILES CAN BE # REDIRECTED TO THE NEW FILES LOCATION # IN HP UX, the lprpp command can be used to change # ASCII files to DOS type (CR/LF) # /usr/lbin/lprpp -160 < "$j" > $newfile # In SOLARIS, THE COMMAND IS /usr/bin/unix2dos. # /usr/bin/unix2dos -ascii "$j" "$newfile" # # Only add this to the list if the copy worked. The user may # have deleted the file after the -r test above, but before # the call to 'cp' # if [ $? = 0 ] then newfiles="$newfiles $newfile" fi i=`expr $i + 1` fi done } FILTER_TYPE=raw # CANONMODEL=${CANONPATH}/lpbin/${MODEL} # # We are replacing the CANONMODEL printer with a standard filter # # if [ -z "${FILTER}" ] then ##### # # If no filter is being used, we use netpr to push the # file to the printer. # (QUOTES ARE IMPORTANT!) ##### case "$TERM" in PS ) # make the "postscript" printers use netpr FILTER=/bin/cat ;; PSR ) # make the "reverse postscript" printers revers # e the # output and the use postio to talk to the prin # ter #FILTER="/usr/lib/lp/postscript/postreverse " #FILTER= FILTER="/usr/lib/lp/postscript/postreverse " ;; * ) # We don't know the type, so just assume that t # he # input and output are the same. Use netpr. FILTER=/bin/cat FILTER_TYPE=pcl ;; esac fi ########### ## ## Check arguments ########### ##### # # This program is invoked as # # ${SPOOLDIR}/.../printer request-id user title copies options files... # # The first three arguments are simply reprinted on the banner page, # the fourth (copies) is used to control the number of copies to print, # the fifth (options) is a blank separated list (in a single argument) # of user or Spooler supplied options (without the -o prefix), # and the last arguments are the files to print. ##### if [ $# -lt 5 ] then errmsg ERROR ${E_IP_ARGS} \ "wrong number of arguments to interface program" \ "consult your system administrator" exit_code=4 exit 4 fi allargs="$*" printer=`basename $0` request_id=$1 user_name=$2 copies=$4 option_list=$5 # In Solaris, the command head is in /usr/bin, change accordingly HEAD="/usr/bin/head" title=`/bin/echo "$3" | ${HEAD} -1` shift 5 files="$*" newfiles= # # TODO: add all the necessary changes to deal with filenames containing # spaces. This does not come for free with the original version of this # script. # # # Note that this assumes "copies" is a standard model option across all # printer models. If this is not true, we need to deal with this differently # modelopts="copies=${copies}" # # The only "standard" option we will take is nobanner. # # NOTE: banner pages are disabled right now (by always turning them off) # # Notice there is no way to set nobanner back to "no". By setting the # default to nobanner=yes, we essentially disable it forever. # # nobanner="no" nobanner="yes" # #copy files to temp files copyfiles # # In the event of an option parsing error, we can't rely on dbg and # dbgfiles in -o options. This is because a parsing error could happen # and these are assumed to be files... In this case, uncomment the lines # below to enable debugging # #dbginit $printer #trap '' 0 #dbgout "All Arguments: ${allargs}" #dbgout "Option List: ${option_list}" #dbgout "File List: ${files}" # # Parse the options common to all models of printers. Add the # remaining options to the modelopts variable and call the model # program on them. # inlist= for i in ${option_list} do case ${inlist}${i} in nobanner ) nobanner="yes" ;; dbg ) dbginit $printer ;; dbgfiles ) trap '' 0 ;; stty=* | flist=* | lpd=* ) inlist=`expr "${inlist}${i}" : "^\([^=]*=\)"` case "${i}" in ${inlist}\'*\' ) item=`expr "${i}" : "^[^=]*='*\(.*\)'\$"` ;; ${inlist}\' ) continue ;; ${inlist}\'* ) item=`expr "${i}" : "^[^=]*='*\(.*\)\$"` ;; ${inlist}* ) item=`expr "${i}" : "^[^=]*=\(.*\)\$"` ;; *\' ) item=`expr "${i}" : "^\(.*\)'\$"` ;; * ) item="${i}" ;; esac case "${inlist}" in stty= ) stty="${stty} ${item}" ;; flist= ) flist="${flist} ${item}" ;; lpd= ) lpd="${lpd} ${item}" ;; esac case "${i}" in ${inlist}\'*\' ) inlist= ;; ${inlist}\'* ) ;; *\' | ${inlist}* ) inlist= ;; esac ;; * ) modelopts="${modelopts} '${i}'" ;; esac done dbgout "Interface called with: $allargs" # # Now generate the temporary files with all the PJL, etc. # newfiles= i=0 for file in ${files} do if [ -r "${file}" ] then # # Generate a new name for the file, and redirect stdout # to that file. Can't use double quotes around the file # name (to preserve spaces) since the redirection of 3 fails # when they exist. # tmp=`basename "$file"` newfile=`echo "${TMPPREFIX}/${tmp}.prn.${i}" | sed 's/ /\ /g'` newfiles="${newfiles} ${newfile}" i=`expr $i + 1` # Redirect Standard Output to file # in order to insert the PCL/PJL commands exec 1>${newfile} if [ "${FILTER_TYPE}" = pcl ] then # Initialize the imageRUNNER 600 echo '%-12345X@PJL SET PAGEPROTECT = OFF ' echo "@PJL JOB NAME = \"${file}\" " echo "@PJL COMMENT CANPJL SET DEVICE=PRINTER " echo "@PJL COMMENT CANPJL SET USERNAME=\"$user_name\" " echo "@PJL COMMENT CANPJL SET DOCNAME=\"${file}\" " echo "@PJL COMMENT CANPJL SET ENGINESPOOL=GENERICOFF " echo "@PJL COMMENT CANPJL SET SLIPSHEET=GENERICOFF " echo "@PJL COMMENT CANPJL SET TONERREDUCTION=GENERICOFF " echo "@PJL COMMENT CANPJL SET SORTERMODE=GENERICON " # Let's process the CANON PJL commands first # for j in ${option_list} do # CONVERT THE PARAMETER TO UPPER CASE # Add additional logic to 'sed' or 'tr' to remove spaces in the option list OPTION=`echo "${j}" | tr "[:lower:]" "[:upper:]"` PARAMETER=`echo "${OPTION}" | sed 's/^.*=//'` case ${PARAMETER} in ON) PARAMETER="GENERICON" ;; OFF) PARAMETER="GENERICOFF" ;; STITCH | SADDLESTITC | SADDLESTI | SADDLEST | SADDLES | SADDLES | SADDLE | SADDL | SADD | SAD | SA) PARAMETER="SADDLESTITCH" ;; UPLEFT | UPLEF | UPLE | UPL) PARAMETER="ONEUPLEFT" ;; UPRIGHT | UPRIGH | UPRIG | UPRI | UPR) PARAMETER="ONEUPRIGHT" ;; LOWLEFT | LOWLEF | LOWLE | LOWL) PARAMETER="ONELOWLEFT" ;; TRANSPARENC | TRANSPAREN | TRANSPARE | TRANSPAR | TRANSPA | TRANSP | TRANS | TRAN | TRA | TR) PARAMETER="TRANSPARENCY" ;; PAPE | PAP | PA) PARAMETER="PAPER" ;; TO) PARAMETER="TOP" ;; BOTTO | BOTT | BOT | BO) PARAMETER="BOTTOM" ;; RIGH | RIG | RI) PARAMETER="RIGHT" ;; DEC | DE) PARAMETER="DECK" ;; LETTE | LETT | LET) PARAMETER="LETTER" ;; LEGA | LEG) PARAMETER="LEGAL" ;; LEDGE | LEDG | LED) PARAMETER="LEDGER" ;; STATEMEN | STATEME | STATEM | STATE | STAT | STA) PARAMETER="STATEMENT" ;; EXECUTIV | EXECUTI | EXECUT | EXECU | EXEC | EXE) PARAMETER="EXECUTIVE" ;; PORTRAI | PORTRA | PORTR | PORT | POR | PO) PARAMETER="PORTRAIT" ;; LANDSCAP | LANDSCA | LANDSC | LANDS | LAND | LAN | LA) PARAMETER="LANDSCAPE" ;; NON | NO) PARAMETER="NONE" ;; LON | LO) PARAMETER="LONG" ;; SHOR | SHO | SH) PARAMETER="SHORT" ;; esac case ${OPTION} in MAILBOX=* | MAILBO=* | MAILB=* | MAIL=* | MAI=* | MAI=* | MA=*) case ${PARAMETER} in [0-99]) echo "@PJL COMMENT CANPJL SET DEVICE=MAILBOX " echo "@PJL COMMENT CANPJL SET MAILBOXNUMBER=${PARAMETER} " ;; esac ;; STAPLE=* | STAPL=* | STAP=* | STA=* | ST=*) case ${PARAMETER} in GENERICOFF | GENERICON | ONEUPLEFT | ONEUPRIGHT | ONELOWLEFT | TWOUP | TWOLOW | TWOLEFT | SADDLESTITCH) echo "@PJL COMMENT CANPJL SET STAPLE=${PARAMETER} " ;; esac ;; ZFOLD=* | FOLD=* | ZFOL=* | ZFO=* | ZF=*) case ${PARAMETER} in GENERICOFF | GENERICON | TOP | BOTTOM | RIGHT | LEFT) echo "@PJL COMMENT CANPJL SET ZFOLD=${PARAMETER} " ;; esac ;; PUNCH=* | PUNC=* | PUN=* | PU=*) case ${PARAMETER} in GENERICOFF | GENERICON | TOP | BOTTOM | RIGHT | LEFT) echo "@PJL COMMENT CANPJL SET PUNCH=${PARAMETER} " ;; esac ;; BOOKLET=* | BOOKLE=* | BOOKL=* | BOOK=* | BOO=* | BO=*) case ${PARAMETER} in GENERICOFF | GENERICON) echo "@PJL COMMENT CANPJL SET BOOKLET=${PARAMETER} " ;; esac ;; MEDIATYPE=* | MEDIATYP=* | MEDIAT=* | MEDIAT=* | MEDIA=* | MEDI=* | MED=* | ME=*) case ${PARAMETER} in PAPER | TRANSPARENCY) echo "@PJL COMMENT CANPJL SET MEDIATYPE=${PARAMETER} " ;; esac ;; RESOLUTION=* | RESOLUTIO=* | RESOLUTI=* | RESOLUT=* | RESOLU=* | RESOL=* | RESO=* | RES=* | RE=*) case ${PARAMETER} in 300 | 600) echo "@PJL SET RESOLUTION=${PARAMETER} " ;; esac ;; esac done #Last PJl COMMAND echo "@PJL ENTER LANGUAGE=PCL " # (Finished with PJL commands for now) # Initialize the STRING for PCL codes STRING= # If no options are specified, assume that Tray is autoselect, and papersize is LETTER if [ -z "${option_list}" ] then STRING=$STRING'&l7H' # Auto paper select STRING=$STRING'&l2A' # Select LETTER size paper fi # # Parse the options common to all models of printers. Add the # remaining options to the modelopts variable and call the model # program on them. # for j in ${option_list} do # Add additional logic to 'sed' or 'tr' to remove spaces in the option list # CONVERT THE PARAMETER TO UPPER CASE OPTION=`echo "${j}" | tr "[:lower:]" "[:upper:]"` PARAMETER=`echo "${OPTION}" | sed 's/^.*=//'` case ${OPTION} in SOURCE=* | PAPERSOURCE=* | PAPERSOURC=* | PAPERSOUR=* | PAPERSOU=* | PAPERSO=* | PS=*) case ${PARAMETER} in # These are for the IR 210/400/600 # -1) # STRING=$STRING'&l2H' # ;; # 0) # STRING=$STRING'&l7H' # ;; # 1) # STRING=$STRING'&l8H' # ;; # 2) # STRING=$STRING'&l4H' # ;; # 3) # STRING=$STRING'&l5H' # ;; # 4) # STRING=$STRING'&l20H' # ;; # 5) # STRING=$STRING'&l21H' # ;; # 6) # STRING=$STRING'&l22H' # ;; # deck) # STRING=$STRING'&l23H' # ;; # These are for the IR 5000/6000 -1) STRING=$STRING'&l2H' ;; 0) STRING=$STRING'&l7H' ;; 1) STRING=$STRING'&l5H' ;; 2) STRING=$STRING'&l1H' ;; 3) STRING=$STRING'&l4H' ;; 4) STRING=$STRING'&l6H' ;; 5) STRING=$STRING'&l21H' ;; 6) STRING=$STRING'&l22H' ;; deck) STRING=$STRING'&l8H' ;; # These are for the IR 8500/7000 # -1) # STRING=$STRING'&l2H' # ;; # 0) # STRING=$STRING'&l7H' # ;; # 1) # STRING=$STRING'&l8H' # ;; # 2) # STRING=$STRING'&l4H' # ;; # 3) # STRING=$STRING'&l5H' # ;; # 4) # STRING=$STRING'&l20H' # ;; # 5) # STRING=$STRING'&l21H' # ;; # 6) # STRING=$STRING'&l22H' # ;; # deck) # STRING=$STRING'&l23H' # ;; *) STRING=$STRING'&l7H' # Auto paper select ;; esac ;; # *) # # # STRING=$STRING'&l7H' # Auto paper select # # ;; esac case ${OPTION} in SIZE=* | PAPERSIZE=* | PAPERSIZ=* | PAPERSI=*) case ${PARAMETER} in A4) STRING=$STRING'&l26A' ;; A3) STRING=$STRING'&l27A' ;; A5) STRING=$STRING'&l25A' ;; A6) STRING=$STRING'&l24A' ;; LETTER) STRING=$STRING'&l2A' ;; LEGAL) STRING=$STRING'&l3A' ;; LEDGER) STRING=$STRING'&l6A' ;; STATEMENT) STRING=$STRING'&l11A' ;; EXECUTIVE) STRING=$STRING'&l1A' ;; *) STRING=$STRING'&l2A' # Select letter size paper ;; esac ;; # *) # # # STRING=$STRING'&l2A' # Select letter size paper # ;; esac case ${OPTION} in ORIENTATION=* | ORIENTATIO=* | ORIENTATI=* | ORIENTAT=* | ORIENTA=* | ORIENT=* | ORIEN=* | ORIE=* | ORI=* | OR=*) case ${PARAMETER} in PORTRAIT) STRING=$STRING'&l0O' ;; LANDSCAPE) STRING=$STRING'&l1O' ;; esac ;; DUPLEX=* | DUPLE=* | DUPL=* | DUP=* | DU=*) case ${PARAMETER} in NONE) STRING=$STRING'&l0S' ;; LONG) STRING=$STRING'&l1S' ;; SHORT) STRING=$STRING'&l2S' ;; esac ;; STARBIN=* | STARBIN=* | STARB=* | STAR=* | STA=* | ST=*) case ${PARAMETER} in 1) STRING=$STRING'&l1G' ;; 2) STRING=$STRING'&l2G' ;; 3) STRING=$STRING'&l3G' ;; 4) STRING=$STRING'&l4G' ;; 5) STRING=$STRING'&l5G' ;; 6) STRING=$STRING'&l6G' ;; 7) STRING=$STRING'&l7G' ;; 8) STRING=$STRING'[&l8G' ;; 9) STRING=$STRING'[&l9G' ;; esac ;; PITCH=* | PITCH=* | PITC=* | PIT=* | PI=*) # Remove alphabetical characters from pitch # Apparentntly, the trying to remove alpha # characters from PARAMETER 1, using the command below # causes it to remove everything. We'll use this # parameter as is to add to the string. #PARAMETER1= `echo "${PARAMETER}" | tr -d "[:alpha:]" ` #STRING=$STRING'(s'"$PARAMETER1""H" # We are using the original PARAMETER instead of # the cooked PARAMETER1 STRING=$STRING'(s'"$PARAMETER""H" ;; HEIGHT=* | HEIGH=* | HEIG=* | HEI=* | HE=*) # Remove alphabetical characters from font size #PARAMETER1= `echo "${PARAMETER}" | tr -d "[:alpha:]" ` #STRING=$STRING'(s'"$PARAMETER1""V" # (SEE ABOVE) STRING=$STRING'(s'"$PARAMETER""V" ;; LEFTMARGIN=* | LMARGIN=* | LEFTMARGI=* | LEFTMARG=* | LEFTMAR=* | LEFTMA=* | LEFTM=* | LEFT=* | LM=*) STRING=$STRING'&a'"$PARAMETER1""L" ;; RIGHTMARGIN=* | RMARGIN=* | RIGHTMARGI=* | RIGHTMARG=* | RIGHTMAR=* | RIGHTMA=* | RIGHTM=* | RIGHT=* | RM=*) STRING=$STRING'&a'"$PARAMETER1""M" ;; esac done # Print the STRING containing the PCL codes # without a newline, so output is not distorted echo "$STRING\c" fi # If FILTER_TYPE = pcl # Redirect-append standard output? (3) to new file exec 3>>${newfile} # # The model program generates the banner page... Here we look at # nobanner to see if the banner page has been supressed. If it has, # we will not generate anything. Otherwise, we will create the # arguments that the model program needs to generate the banner. # # Note that a banner page will ONLY be generated the first time # through this loop. # bopts= if [ $nobanner = "no" ] then bopts="-b -j '${request_id}' -u '${user_name}' -t '${title}'" nobanner="yes" fi ##### # # Here's where we set up the $LPTELL program to # capture fault messages, and... # # Here's where we print the file. # # We set up a pipeline to $LPTELL, but play a trick # to get the filter's standard ERROR piped instead of # its standard OUTPUT: Divert the standard error (#2) to # the standard output (#1) IN THE PIPELINE. The shell # will have changed #1 to be the pipe, not the # printer, so diverting #2 connects it to the pipe. # We then change the filter's #1 to a copy of the real # standard output (the printer port) made earlier, # so that is connected back to the printer again. # # We do all this inside a parenthesized expression # so that we can get the exit code; this is necessary # because the exit code of a pipeline is the exit # code of the right-most command, which isn't the # filter. # # These two tricks could be avoided by using a named # pipe to connect the standard error to $LPTELL. In # fact an early prototype of this script did just # that; however, the named pipe introduced a timing # problem. The processes that open a named pipe hang # until both ends of the pipe are opened. Cancelling # a request or disabling the printer often killed one # of the processes, causing the other process to hang # forever waiting for the other end of the pipe to # be opened. ##### EXIT_CODE=${TMPPREFIX}/e trap '' 1 # Let the filter handle a hangup trap '' 2 3 # and interrupts ( ##### # Put the 0<"${file}" before the "eval" to keep # clever users from giving a file name that # evaluates as something to execute. ##### # dbgout "Calling model: ${FILTER} ${bopts} ${modelopts}" # 0<${file} eval ${FILTER} ${bopts} ${modelopts} 2>&1 1>&3 0<${file} eval ${FILTER} 2>&1 1>&3 echo $? >${EXIT_CODE} ) | ${LPTELL} ${LPTELL_OPTS} ${printer} trap 'catch_hangup; exit_code=129 exit 129' 1 trap 'catch_interrupt; exit_code=129 exit 129' 2 3 exit_code=`cat ${EXIT_CODE}` if [ -n "${exit_code}" -a 0 -ne "${exit_code}" ] then trap '' 15 # Avoid dying from disable sleep 4 # Give $LPTELL a chance to tell exit ${exit_code} fi # # Move the copy of stdout back to stdout rather than # the new output file # exec 3>&1 else # # Complain about every file that we can't read # errmsg WARNING ${E_IP_BADFILE} \ "cannot read file \"${file}\"" \ "see if the file still exists and is readable, or consult your system administrator; printing continues" fi done # # TODO: verify exit_code must be 0 at this point. # # # Now call lp for the temporary files. Use the transfer queue to do the # actual transmission of the files to the device. # # Note that we use -c to force lp to copy the job files. We need to do this # since we have to clean up the temporary files we created. We also preserve # the title of the print job with -t. # # The commands below choose between printing to the remote printer # with or without banner # dbgout "Calling lp: lp -c -t \"${title}\" -d ${printer}xfer ${newfiles}" if [ $nobanner="yes" ] then # Solaris uses -o nobanner #lp -c -t "${title}" -n $copies -d ${printer}xfer -o nobanner ${newfiles} 1>/dev/null 2>&5 # HP UX uses -o nb to stop banners lp -c -t "${title}" -n $copies -d ${printer}xfer -o nb ${newfiles} 1>/dev/null 2>&5 else lp -c -t "${title}" -n $copies -d ${printer}xfer ${newfiles} 1>/dev/null 2>&5 fi # This is the same as above, but copies are generated through a loop. This is used for # systems that don't accept the "-n copies" command. #copy=1 #while [ $copy -le $copies ] #do #if [ $nobanner="yes" ] #then # lp -c -t "${title}" -d ${printer}xfer -o nb ${newfiles} 1>/dev/null 2>&5 #else # lp -c -t "${title}" -d ${printer}xfer ${newfiles} 1>/dev/null 2>&5 #fi #copy=`expr $copy + 1` #done exit_code=$? if [ -n "${exit_code}" -a 0 -ne "${exit_code}" ] then # TODO: errmsg with appropriate 'lp' string. exit ${exit_code} fi exit_code=0 exit 0