4 # The contents of this file are subject to the terms of the
5 # Common Development and Distribution License (the "License").
6 # You may not use this file except in compliance with the License.
8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 # or http://www.opensolaris.org/os/licensing.
10 # See the License for the specific language governing permissions
11 # and limitations under the License.
13 # When distributing Covered Code, include this CDDL HEADER in each
14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 # If applicable, add the following below this CDDL HEADER, with the
16 # fields enclosed by brackets "[]" replaced with your own identifying
17 # information: Portions Copyright [yyyy] [name of copyright owner]
22 # Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 # Use is subject to license terms.
25 #pragma ident "%Z%%M% %I% %E% SMI"
29 ## Standard printer interface program.
34 # Until we get to the point below where the printer port
35 # and physical printer are initialized, we can't do much
36 # except exit if the Spooler/Scheduler cancels us.
42 # We can be clever about getting a hangup or interrupt, though, at least
43 # until the filter runs. Do this early, even though $LPTELL
44 # isn't defined, so that we're covered.
50 "The connection to the printer dropped; perhaps the printer went off-line?" \
51 | ${LPTELL} ${printer}
59 "Received an interrupt from the printer. The reason is unknown,
60 although a common cause is that the baud rate is too high." \
61 | ${LPTELL} ${printer}
65 trap 'catch_hangup; exit_code=129 exit 129' 1
66 trap 'catch_interrupt; exit_code=129 exit 129' 2 3
70 # Most of the time we don't want the standard error to be captured
71 # by the Spooler, mainly to avoid "Terminated" messages that the
72 # shell puts out when we get a SIGTERM. We'll save the standard
73 # error channel under another number, so we can use it when it
76 # Open another channel to the printer port, for use when the
77 # regular standard output won't be directed there, such as in
78 # command substitution (`cmd`).
80 exec 5>&2 2>/dev/null 3>&1
84 # Set some globally used variables and functions.
88 : ${SPOOLDIR:=/usr/spool/lp}
89 : ${TERMINFO:=/usr/lib/terminfo}
90 : ${CHARSETDIR:=/usr/lib/charsets}
92 : ${LOCALPATH:=${SPOOLDIR}/bin}
93 PATH="/bin:/usr/bin:${LOCALPATH}"
95 MAX_COLS_SMALL_BANNER=40
99 # On the 3.2 release of the 386unix product, the parallel port does
100 # not support any ioctl calls. As a result, we cannot set the opost
101 # and onlcr attributes to have <NL>'s expanded to <CR><NL>. This
102 # "filter" gets the job done for us.
104 : ${FIX386BD:=${LOCALPATH}/386parallel}
105 if [ -n "${FIX386BD}" -a -x "${FIX386BD}" ]
107 FIX386BD="| ${FIX386BD}"
113 # Use ${TMPPREFIX} as the prefix for all temporary files, so
114 # that cleanup is easy. The prefix may be up to 13 characters
115 # long, so you only have space for one more character to make
116 # a file name. If necessary, make a directory using this prefix
117 # for better management of unique temporary file names.
119 TMPPREFIX=${TMPDIR}/`uname -n`$$
122 # Before exiting, set ${exit_code} to the value with which to exit.
123 # Otherwise, the exit from this script will be 0.
125 trap 'rm -fr ${TMPPREFIX}*; exit ${exit_code}' 0
128 # ${LPTELL} is the name of a program that will send its
129 # standard input to the Spooler. It is used to forward
130 # the description of a printer fault to the Spooler,
131 # which uses it in an alert to the administrator.
133 if [ ! -x "${LPTELL:=${LOCALPATH}/lp.tell}" ]
139 if [ "no" = "${header}" ]
141 errmsg ERROR ${E_IP_UNKNOWN} \
142 "unknown printer/interface failure" \
143 "consult your system administrator;
144 reasons for failure (if any) follow:"
155 # ${DRAIN} is the name of a program that will wait
156 # long enough for data sent to the printer to print.
158 if [ -x "${LOCALPATH}/drain.output" ]
160 DRAIN="${LOCALPATH}/drain.output 5" # wait only five seconds
166 # ${LPTSOLSEPARATOR} is the name of a program to put banner and trailer
167 # pages around the job.
169 if [ -x ${LOCALPATH}/lp.tsol_separator ]
171 LPTSOLSEPARATOR=${LOCALPATH}/lp.tsol_separator
173 echo "${LOCALPATH}/lp.tsol_separator not found." >&2
178 # ${LPCAT} is the name of a program to use as a default
179 # filter. Minimally it should copy its standard input to
180 # the standard output, but it should also trap printer
181 # faults. The current LPCAT traps hangups (DCD dropping, SIGHUP),
182 # interrupts (SIGINT, SIGQUIT), broken pipe (SIGPIPE), and
183 # excess delays in sending data to the printer, interpreting all
186 if [ ! -x "${LPCAT:=${LOCALPATH}/lp.cat}" ]
192 # ${LPSET} is the name of a program that will set the
193 # character pitch, line pitch, page width, page length,
194 # and character set. It helps to have this in a single
195 # binary program so that (1) it's faster than calls
196 # to "tput"; and (2) it can access the new Terminfo
197 # capabilities for printers (on pre SVR3.2 machines, tput can't).
199 if [ ! -x "${LPSET:=${LOCALPATH}/lp.set}" ]
211 # The funny business with the "2>&1 1>&3" is to let us capture
212 # the standard ERROR, not the standard OUTPUT as is the usual case
213 # with foo=`cmd`. The standard output will go to the printer.
215 [ -n "${stty1}" ] && stty ${stty1} 0<&1
216 chk=`${LPSET} "$1" "$2" "$3" "$4" "$5" 2>&1 1>&3`
217 [ -n "${stty2}" ] && stty ${stty2} 0<&1
221 # The standard error of the delivered ${LPSET} program
222 # is a string of letters, H, V, W, L, S, which correspond
223 # to cpi, lpi, width, length, and character set. A letter
224 # is present only if the corresponding attribute could not
231 errmsg WARNING ${E_IP_BADCPI} \
232 "can't select the character pitch \"${cpi}\"" \
233 "check the valid pitches for the printer,
234 or consult your system administrator;
238 errmsg WARNING ${E_IP_BADLPI} \
239 "can't select the line pitch \"${lpi}\"" \
240 "check the valid pitches for the printer,
241 or consult your system administrator;
246 errmsg WARNING ${E_IP_BADWIDTH} \
247 "can't select the page width \"${width}\"" \
248 "check the valid widths for the printer,
249 or consult your system administrator;
254 errmsg WARNING ${E_IP_BADLENGTH} \
255 "can't select the page length \"${length}\"" \
256 "check the valid lengths for the printer,
257 or consult your system administrator;
261 errmsg WARNING ${E_IP_BADCHARSET} \
262 "can't select the character set \"${CHARSET}\"" \
263 "check the name given in the -S option,
264 or consult your system administrator;
273 # ${TPUT} is "tput" IF it works. We'll disable it if we get an
274 # ugly error message the first time we use it. See the TERM variable
275 # later in the script.
277 # NOTE: The check we use to see if "tput" works is to use an OLD
278 # Terminfo capability, like "lines". If it works with that it may
279 # still fail with some of the newer capabilities like "init" (SVR3.0)
280 # or "swidm" (SVR3.2), because the version of "tput" we have on your
281 # machine is older. Thus, on some of the code where ${TPUT} is used
282 # you'll see "2>/dev/null" being used to avoid ugly error messages.
287 # Error message formatter:
291 # errmsg severity message-number problem help
293 # where severity is "ERROR" or "WARNING", message-number is
294 # a unique identifier, problem is a short description of the
295 # problem, and help is a short suggestion for fixing the problem.
311 E_IP_ERRORS=12 # (in slow.filter)
322 # tag=`expr "${LP_ERR_LABEL}" : "\(.*\):"``expr "${LP_ERR_LABEL}" : ".*:\(.*\)"`
323 echo "${LP_ERR_LABEL}: ${sev}: $3
334 echo "`expr \"$1\" : \"^[^=]*=\(.*\)\"`"
339 # This program is invoked as
341 # ${SPOOLDIR}/.../printer request-id user title copies options files...
343 # The first three arguments are simply reprinted on the banner page,
344 # the fourth (copies) is used to control the number of copies to print,
345 # the fifth (options) is a blank separated list (in a single argument)
346 # of user or Spooler supplied options (without the -o prefix),
347 # and the last arguments are the files to print.
352 errmsg ERROR ${E_IP_ARGS} \
353 "wrong number of arguments to interface program" \
354 "consult your system administrator"
358 printer=`basename $0`
374 for i in ${option_list}
376 case "${inlist}${i}" in
393 # If you want to add simple options (e.g. -o simple)
394 # identify them here.
425 # If you want to add simple-value options (e.g. -o value=a)
426 # identify them here.
435 # If you want to add options that, like "stty",
436 # take a list (e.g. -o lopt='a b c'), identify
437 # them here and below (look for LOPT).
439 stty=* | flist=* | lpd=* )
440 #LOPT stty=* | flist=* | lpd=* | lopt=* )
442 inlist=`expr "${inlist}${i}" : "^\([^=]*=\)"`
445 item=`expr "${i}" : "^[^=]*='*\(.*\)'\$"`
451 item=`expr "${i}" : "^[^=]*='*\(.*\)\$"`
454 item=`expr "${i}" : "^[^=]*=\(.*\)\$"`
457 item=`expr "${i}" : "^\(.*\)'\$"`
466 # We don't dare use "eval" because a clever user could
467 # put something in an option value that we'd end up
472 stty="${stty} ${item}"
475 flist="${flist} ${item}"
481 #LOPT lopt="${lopt} ${item}"
498 errmsg WARNING ${E_IP_OPTS} \
499 "unrecognized \"-o ${i}\" option" \
500 "check the option, resubmit if necessary
508 # Additional ``parameters'' are passed via Shell environment
511 # TERM The printer type (used for Terminfo access)
512 # CHARSET The character set to choose
513 # FILTER The filter to run
517 # Set defaults for unset variables.
521 tput lines 1>/dev/null 2>&1 || TPUT=:
525 if [ -z "${FILTER}" ]
529 # If no filter is being used, we have a little routine that
530 # will push the data to the printer. It traps hangups (loss
531 # of carrier) and checks for excessive delays in sending the
532 # data to the printer. The lesser of the print rate of the printer
533 # (obtained from Terminfo) or the baud rate is used to compute
534 # the expected delay. If neither of these is correct, you
535 # may be experiencing false alarms. If so, give the correct
536 # rate, in characters per second, as a single argument.
537 # An argument of 0 means don't check for delays.
538 # Give an -r option to get a printout of actual delays.
539 # (QUOTES ARE IMPORTANT!)
543 # make the "postscript" printers use postio to
544 # talk to the printer and periodically get a
546 FILTER="/usr/lib/lp/postscript/postio"
549 # make the "reverse postscript" printers reverse the
550 # output and the use postio to talk to the printer
551 FILTER="/usr/lib/lp/postscript/postreverse | \
552 /usr/lib/lp/postscript/postio"
555 # we don't know the type, so just assume that the
556 # input and output are the same
557 if [ `basename "${LPCAT}"` = "lp.cat" ] ; then
558 FILTER="${LPCAT} 0" # infinite delays
559 # FILTER="${LPCAT} 120" # e.g. 120 CPS
560 # FILTER="${LPCAT} -r 0 2>/tmp/delays"
569 ## Initialize the printer port
575 # Initialize everything.
578 # Don't initialize baud rate.
580 # It's not obvious how to tell if a port is parallel or serial.
581 # However, by splitting the initialization into two steps and letting
582 # the serial-only part fail nicely, it'll work.
584 # Another point: The output must be a ``tty'' device. If not, don't
585 # bother with any of this.
588 tty 0<&1 1>/dev/null 2>&1 && {
592 # First set the default parameters,
593 # then the requested parameters.
598 0<&1 2>/dev/null 1>&2
600 cs8 -cstopb -parenb -parodd \
602 opost -olcuc onlcr -ocrnl -onocr -onlret -ofill \
603 nl0 cr0 tab0 bs0 vt0 ff0 \
604 0<&1 2>/dev/null 1>&2
608 if stty ${stty} 0<&1 1>/dev/null 2>&5
612 errmsg ERROR ${E_IP_STTY} \
613 "stty option list failed" \
614 "check the \"-o stty\" option you used,
615 or consult your system administrator"
622 # Here you may want to add other port initialization code.
625 # estty # for printer needing hardware flow control (3B2/EPORTS)
626 # fctty # for printer needing hardware flow control (3B15,3B20)
634 # Find out if we have to turn off opost before initializing the
635 # printer and on after. Likewise, check clocal.
637 # Turning OFF opost (output postprocessing) keeps the UNIX system
638 # from changing what we try to send to the printer. Turning ON
639 # clocal keeps the UNIX system from dropping what we are trying to
640 # send if the printer drops DTR. An example of the former is the
641 # AT&T 479, which wants to send a linefeed (ASCII 10) when a page
642 # width of 10 is set; with opost on, this COULD BE turned into a
643 # carriage-return/linefeed pair. An example of the latter is the
644 # AT&T 455, which momentarily drops DTR when it gets the
645 # initialization string, is2; with clocal off, the UNIX system
646 # stops sending the rest of the initialization sequence at that
649 # THIS CODE MUST FOLLOW THE REST OF THE PORT INITIALIZATION CODE.
651 cur_stty=`stty -a 0<&3`
652 expr "${cur_stty}" : '.*-opost' 1>/dev/null 2>&1 \
653 || stty1="${stty1} -opost" stty2="${stty2} opost"
654 expr "${cur_stty}" : '.*-clocal' 1>/dev/null 2>&1 \
655 && stty1="${stty1} clocal" stty2="${stty2} -clocal"
656 expr "${cur_stty}" : '.* opost.*' 1>/dev/null 2>&1 \
657 || banner_filter=${FIX386BD}
664 ## Initialize the physical printer (Part I).
665 ## Here we bring the printer to a sane state and set the page size.
670 # WARNING! The "echo" command will catch backslashes (\) and
671 # try to interpret the characters following it. Thus, using
672 # "echo" to print string values obtained from "tput" is dangerous.
676 # We're confident that most printers don't have backslashes
677 # in the control sequences for carriage return and form-feed.
678 # We're also confident that these don't contain newlines.
679 # We're also confident that most printers have a linefeed
680 # in the control sequence for doing a newline (move to beginning
681 # of next line), but we can't capture it like we do the
682 # carriage return or form-feed. Thus we set it unconditionally.
683 # We don't set form-feed if it isn't defined, however, because
684 # maybe the printer doesn't have a formfeed. If not set, we're
689 [ -z "${CR}" ] && CR="\r"
695 lines=`${TPUT} lines`
696 [ -z "${lines}" -o 0 -ge "${lines}" ] && lines=66
699 [ -z "${cols}" -o 0 -ge "${cols}" ] && cols=132
703 # Basic initialization. The ``else'' clause is equivalent,
704 # but covers cases where old Terminal Information Utilities are present.
706 [ -n "${stty1}" ] && stty ${stty1} 0<&1
709 # "tput init" will return an "^M" in many cases to "stdout", i.e., printer!
710 # This creates problems for some PS printers
712 if [ "${TERM}" = "PS" -o "${TERM}" = "PSR" ]
715 elif ${TPUT} init 2>/dev/null
729 if [ "8" != "`${TPUT} it`" ]
731 stty tab3 0<&1 1>/dev/null 2>&1
733 elif `${TPUT} ht >/dev/null`
735 tabset="/usr/lib/tabset/${TERM}"
740 stty tab3 0<&1 1>/dev/null 2>&1
744 if [ "${tabset}" != "${file}" -a -r "${file}" ]
752 [ -n "${stty2}" ] && stty ${stty2} 0<&1
756 # Set the page size and print spacing, but not the character set.
757 # We will be doing the character set later (after the header).
759 internal_lpset "${cpi}" "${lpi}" "${width}" "${length}" ""
763 # The banner page (and cancellation page) will
764 # use double width characters if they're available.
766 WIDE_CS=`${TPUT} swidm 2>/dev/null` && NORM_CS=`${TPUT} rwidm 2>/dev/null`
771 # Some printers need to have the banner page filtered.
776 banner_filter="/usr/lib/lp/postscript/postprint | /usr/lib/lp/postscript/postio"
781 if [ -n "${banner_filter}" ]
783 banner_filter="| ${banner_filter}"
788 # Now that the printer is ready for printing, we're able
789 # to record on paper a cancellation.
793 echo "${PAD}${PAD}\c"
794 echo "#####${WIDE_CS} Job ${request_id}${NORM_CS}${NL}\c"
795 echo "#####${WIDE_CS} suspended or canceled${NORM_CS}${NL}\c"
796 echo "${PAD}${PAD}\c"
800 ${TPUT} scs 0 2>/dev/null
802 if [ "${width:-${cols}}" -lt "${MAX_COLS_SMALL_BANNER}" ]
813 trap 'eval canceled ${banner_filter}; exit_code=0 exit' 15
818 ## Print the banner page
823 # You may want to change the following code to get a custom banner.
828 echo "${PAD}${PAD}${PAD}${PAD}${PAD}\c"
829 echo "#####${WIDE_CS} User: ${user_name}${NORM_CS}${NL}\c"
830 if [ -n "$ALIAS_USERNAME" ]
833 echo "#####${WIDE_CS} Alias: ${ALIAS_USERNAME}${NORM_CS}${NL}\c"
838 echo "#####${WIDE_CS} Title: ${title}${NORM_CS}${NL}\c"
841 echo "#####${WIDE_CS} Printed: `LANG=C date '+%a %H:%M %h %d, %Y'`${NORM_CS}${NL}\c"
843 echo "#####${WIDE_CS} Job number: ${request_id}${NORM_CS}${NL}\c"
844 echo "${PAD}${PAD}${PAD}${PAD}${PAD}\c"
854 echo "##### User: ${user_name}${NL}\c"
857 echo "##### Title: ${title}${NL}\c"
859 echo "##### Date: `LANG=C date '+%a %H:%M %h %d, %Y'`${NL}\c"
860 echo "##### Job: ${request_id}${NL}\c"
868 if [ "${width:-${cols}}" -lt "${MAX_COLS_SMALL_BANNER}" ]
872 banner=regular_banner
875 ## Skip this for PS/PSR in TSOL, since lp.tsol_separator handles the banners
876 if [ "no" = "${nobanner}" -a "${TERM}" != "PSR" -a "${TERM}" != "PS" ]
878 ( eval "${banner} ${banner_filter}" 2>&1 1>&3 ) \
879 | ${LPTELL} ${LPTELL_OPTS} ${printer}
884 ## Surround the job by PostScript code to produce banner
885 ## and trailerpages and page headers and footers.
889 BANNER_EXIT_CODE=${TMPPREFIX}.banner.exit_code
890 echo 0 > ${BANNER_EXIT_CODE}
891 TSOLSEPARATOR_LOG=${TMPPREFIX}.banner.errmsg
894 TSOLSEPARATOR_OPTS="-e ${TSOLSEPARATOR_LOG}"
896 if [ "yes" = "${nolabels}" ]
898 TSOLSEPARATOR_OPTS="${TSOLSEPARATOR_OPTS} -l"
901 if [ "yes" = "${nobanner}" ]
903 TSOLSEPARATOR_OPTS="${TSOLSEPARATOR_OPTS} -t /dev/null -b /dev/null"
906 if [ "${TERM}" = "PSR" ]
908 TSOLSEPARATOR_OPTS="${TSOLSEPARATOR_OPTS} -r"
911 # Get rid of the #, TAB and NL characters in the title
912 tsol_title=`echo $title`
913 tsol_title=`echo $tsol_title | sed 's/#//g'`
915 LC_TIME=C ${LPTSOLSEPARATOR} ${TSOLSEPARATOR_OPTS} "${printer}" \
916 "${request_id}" "${user_name}" "${tsol_title}" "${file}"
917 echo $? > ${BANNER_EXIT_CODE}
921 bannerize=tsol_bannerize
923 if [ "yes" = "${nobanner}" -a "yes" = "${nolabels}" ]
928 if [ "${TERM}" != "PSR" -a "${TERM}" != "PS" ]
936 ## Initialize the physical printer (Part II)
937 ## Here we select the character set.
938 ## One could argue that this should be done before the banner is printed,
939 ## but we don't, to keep the banner page looking consistent for the
940 ## operator. You can move this code before the banner code if you
941 ## disagree. If you do, combine it with the other call to "internal_lpset"
942 ## to do everything in one shot.
944 internal_lpset "" "" "" "" "${CHARSET}"
948 ## Print some copies of the file(s)
953 # The protocol between the interface program and the Spooler
956 # All standard error output is assumed to indicate a
957 # fault WITH THE REQUEST. The output is mailed to the
958 # user who submitted the print request and the print
959 # request is finished.
961 # If the interface program sets a zero exit code,
962 # it is assumed that the file printed correctly.
963 # If the interface program sets a non-zero exit code
964 # less than 128, it is assumed that the file did not
965 # print correctly, and the user will be notified.
966 # In either case the print request is finished.
968 # If the interface program sets an exit code greater
969 # than 128, it is assumed that the file did not print
970 # because of a printer fault. If an alert isn't already
971 # active (see below) one will be activated. (Exit code
972 # 128 should not be used at all. The shell, which executes
973 # this program, turns SIGTERM, used to kill this program
974 # for a cancellation or disabling, into exit 128. The
975 # Spooler thus interpretes 128 as SIGTERM.)
977 # A message sent to the standard input of the ${LPTELL}
978 # program is assumed to describe a fault WITH THE PRINTER.
979 # The output is used in an alert (if alerts are defined).
980 # If the fault recovery is "wait" or "begin", the printer
981 # is disabled (killing the interface program if need be),
982 # and the print request is left on the queue.
983 # If the fault recovery is "continue", the interface program
984 # is allowed to wait for the printer fault to be cleared so
985 # it can resume printing.
987 # This interface program relies on filters to detect printer faults.
988 # In absence of a filter provided by the customer, it uses a simple
989 # filter (${LPCAT}) to detect the class of faults that cause DCD
990 # (``carrier'') drop. The protocol between the interface program and
993 # The filter should exit with zero if printing was
994 # successful and non-zero if printing failed because
995 # of a printer fault. This interface program turns a
996 # non-zero exit of the filter into an "exit 129" from
997 # itself, thus telling the Spooler that a printer fault
1000 # The filter should report printer faults via a message
1001 # to its standard error. This interface program takes all
1002 # standard error output from the filter and feeds it as
1003 # standard input to the ${LPTELL} program.
1005 # The filter should wait for a printer fault to clear,
1006 # and should resume printing when the fault clears.
1007 # Preferably it should resume at the top of the page
1008 # that was being printed when the fault occurred.
1009 # If it waits and finishes printing, it should exit
1010 # with a 0 exit code. If it can't wait, it should exit
1011 # with a non-zero exit code.
1013 # The interface program expects that ANY message on the
1014 # standard error from the filter indicates a printer fault.
1015 # Therefore, a filter should not put user (input) error
1016 # messages on the standard error, but on the standard output
1017 # (where the user can read them when he or she examines
1024 while [ $i -le $copies ]
1026 for file in ${files}
1032 # Here's where we set up the $LPTELL program to
1033 # capture fault messages, and...
1035 # Here's where we print the file.
1037 # We set up a pipeline to $LPTELL, but play a trick
1038 # to get the filter's standard ERROR piped instead of
1039 # its standard OUTPUT: Divert the standard error (#2) to
1040 # the standard output (#1) IN THE PIPELINE. The shell
1041 # will have changed #1 to be the pipe, not the
1042 # printer, so diverting #2 connects it to the pipe.
1043 # We then change the filter's #1 to a copy of the real
1044 # standard output (the printer port) made earlier,
1045 # so that is connected back to the printer again.
1047 # We do all this inside a parenthesized expression
1048 # so that we can get the exit code; this is necessary
1049 # because the exit code of a pipeline is the exit
1050 # code of the right-most command, which isn't the
1053 # These two tricks could be avoided by using a named
1054 # pipe to connect the standard error to $LPTELL. In
1055 # fact an early prototype of this script did just
1056 # that; however, the named pipe introduced a timing
1057 # problem. The processes that open a named pipe hang
1058 # until both ends of the pipe are opened. Cancelling
1059 # a request or disabling the printer often killed one
1060 # of the processes, causing the other process to hang
1061 # forever waiting for the other end of the pipe to
1064 EXIT_CODE=${TMPPREFIX}e
1065 trap '' 1 # Let the filter handle a hangup
1066 trap '' 2 3 # and interrupts
1069 # Put the 0<${file} before the "eval" to keep
1070 # clever users from giving a file name that
1071 # evaluates as something to execute.
1073 0<${file} $bannerize | eval ${FILTER} 2>&1 1>&3
1074 echo $? >${EXIT_CODE}
1075 ) | ${LPTELL} ${LPTELL_OPTS} ${printer}
1077 # if lp.tsol_separator had an error, send its logged
1078 # error message to LPTELL.
1079 banner_exit_code=`cat ${BANNER_EXIT_CODE}`
1080 if [ -n "${banner_exit_code}" -a \
1081 0 -ne "${banner_exit_code}" -a \
1083 -r "${TSOLSEPARATOR_LOG}" ]
1085 cat ${TSOLSEPARATOR_LOG} | ${LPTELL} ${printer}
1086 echo 77 > ${EXIT_CODE}
1089 trap 'catch_hangup; exit_code=129 exit 129' 1
1090 trap 'catch_interrupt; exit_code=129 exit 129' 2 3
1091 exit_code=`cat ${EXIT_CODE}`
1093 if [ -n "${exit_code}" -a 0 -ne "${exit_code}" ]
1095 trap '' 15 # Avoid dying from disable
1096 sleep 4 # Give $LPTELL a chance to tell
1100 if [ -n "${FF}" -a "no" = "${nofilebreak}" ]
1109 # Don't complain about not being able to read
1110 # a file on second and subsequent copies, unless
1111 # we've not complained yet. This removes repeated
1112 # messages about the same file yet reduces the
1113 # chance that the user can remove a file and not
1114 # know that we had trouble finding it.
1116 if [ "${i}" -le 1 -o -z "${badfileyet}" ]
1118 errmsg WARNING ${E_IP_BADFILE} \
1119 "cannot read file \"${file}\"" \
1120 "see if the file still exists and is readable,
1121 or consult your system administrator;
1133 # Skip this for TSOL, since lp.tsol_separator handles the banners
1135 # if [ "no" = "${nobanner}" -a "${TERM}" = "PSR" ]
1137 # ( eval "${banner} ${banner_filter}" 2>&1 1>&3 ) \
1138 # | ${LPTELL} ${LPTELL_OPTS} ${printer}
1141 if [ -n "${exit_code}" -a 0 -ne "${exit_code}" ]
1148 # Always ensure the complete job ends with a ``formfeed'', to
1149 # let the next job start on a new page. (If someone wants to
1150 # concatenate files, they can give them in one job.)
1151 # So, if we haven't been putting out a ``formfeed'' between files,
1152 # it means we haven't followed the last file with a formfeed,
1155 if [ -n "${FF}" -a "yes" = "${nofilebreak}" ]