Specifications

4-151
Printer, Plotter, and Spooler Subsystem Programming
–P asc –o –f –o p /etc/motd
These are the arguments qprt tried to pass to enq. You see them because qprt found echo
instead of enq. The following command is equivalent to the command shown in step 2
above:
enq –P asc –o –f –o p /etc/motd
The –o option specifies that flags specific to the backend should be passed to the backend.
The –o option can be thought of as a free pass through the syntax checking that occurs
before the enq command builds a job description file and notifies the qdaemon of the
existence of a new job.
Suppose that you want to set up a queue that will print a range of lines from an ASCII file.
For example, suppose you read /usr/lpp/bos/README and find 35 lines that you want to
print so you can fax them to someone or tack them to your wall for reference. You could edit
/etc/qconfig and add the following lines:
partial:
device = partial
partial:
file = FALSE
backend = /usr/bin/partial
The file /usr/bin/partial could be a shell script with ownership of root.printq and with
permissions of 755. Its contents could be as follows:
#!/bin/ksh
BEGIN=$1
END=$2
let DIFF=END–BEGIN+1
FILE=$3
/usr/bin/head –${END} ${FILE} | tail –${DIFF} | /usr/bin/qprt –Pasc
If you wanted to print lines 189 through 223 of /usr/lpp/bos/README, you could use the
partial queue as follows:
qprt –Ppartial –o 189 –o 223 /usr/lpp/bos/README
When the backend executes, BEGIN is assigned 189, END is assigned 223, and DIFF is
assigned 35, which is the number of chosen lines. FILE is assigned /usr/lpp/bos/README.
The head command truncates /usr/lpp/bos/README immediately after the last requested
line. The output is piped to the tail command, which selects the last 35 lines of the truncated
file and pipes them to the qprt command, which will take input from stdin. The qprt
command submits the lines to the queue named asc.
Filter that Maps Linefeeds to Carriage Returns and Linefeeds
Many users have written or purchased applications that prepare data streams to fill in the
blanks on pre–printed checks, invoices, bills–of–lading, or other forms. Printing these data
streams requires precise control of the physical printer. It is often the case that the job
processing pipeline created by piobe inserts or deletes enough data from the original data
stream that the output data no longer falls at the proper position on the pre–printed form.
The root user can frequently use the lsvirprt command to set the value of the _d attribute in
the virtual printer definition to p. On an ASCII queue on an IBM 4029 LaserPrinter, this
would cause piobe to select the ip pipeline to process the job. The ip pipeline is for
passthru printing, which means the formatter filters uses the passthru() routine to simply
pass the input data stream through to the printer without modification.