User`s guide
4-127
Printer, Plotter, and Spooler Subsystem Programming
and in other similar situations, it does not work with printers. Printers only print the data
which they are sent. Issuing the two commands
splp –p+ lp0
cat /etc/motd > /dev/lp0
results in something like the following appearing on the printer.
This is a test version of /etc/motd, used to demonstrate what hap
pens when a
printer device driver, such as /dev/lp0, is placed into or taken
out of passthru mode
. Printers will print either exactly what they are sent, if you
set the job conditions up correctly, or, on the most current prin
ters, you may be able to direct
the printer to perform certain mappings for you.
There are no carriage returns in
this file, and the only blank line occurs
immediately before this one.
In the first example, all of the device driver settings are honored. In particular, the mapping
of a linefeed to a linefeed and a carriage return is turned on. When the device drivers is
writing characters to the physical printer, it sends a carriage return after each linefeed. It
also honors the settings for page width.
In the second example, the device driver is limited to simply writing each single–byte
character of /etc/motd to the physical printer, without any mapping or other modification of
the data stream occuring. Most ASCII printers, current or not, have enough intelligence to
make a few decisions of their own. When the first sentence of /etc/motd ends, the linefeed
drops the printhead straight down one line; there is no carriage return to move the printhead
back to the left margin. The first four letters of the word ”printer,” ”prin,” are printed. At that
point the printer itself, not the device driver, determines that the right margin has been
reached and so prints a carriage return, returning the printhead to the left margin. Printing
continues with the next character in the data stream.
In the second example, the job does not even print until the reset button on the printer is
pressed. This is because the printer has not received enough date (characters) to
automatically eject a page, and no formfeeds were sent to the printer to cause it to eject the
page; the –f parameter on the device driver is ignored.
Formatter Filter Pass–Through Mode
After a job is submitted to the spooler it eventually passes to the formatter filter for
processing and delivery to the printer device driver. The formatter filter always opens the
printer device driver in pass–through mode. Jobs submitted to the spooler, as opposed to
data streams that are sent directly to the printer device driver, are always processed or
otherwise modified by a formatter filter and not by the printer device driver.
Like the printer device driver, the formatter filter also has two modes of operation:
pass–through and non–pass–through. Again, the mode of operation selected for a given job
determines how or even if a data stream is processed.
The _d attribute in a virtual printer definition (a digested colon file) specifies the input data
stream type for the queue associated with that virtual printer. The virtual printer definition
also specifies the formatter filter for that input data stream type. When the formatter filter is
invoked to process a job, the process that runs the formatter (pioformat) filter checks the
value of the _d attributes and decides whether or not to invoke the formatter filter in
pass–through mode. If pass–through mode is selected, the formatter filter simply uses the
passthru() subroutine to read the input stream and send it unmodified to the printer device
driver. If pass–through mode is not selected, the formatter filter uses the lineout()
subroutine to process the input data stream line by line. In either case, the printer device
driver was opened for writing in pass–through mode and performs no processing on the
output data stream.