Specifications

6-10
Guide to Printers and Printing
Printer Interface Scripts
A printer interface script is a program that the print service uses to manage the printer each
time it prints a file. The interface script initializes the printer, takes advantage of its particular
capabilities, prints the file, and reports any errors.
Note: If you have an interface program that you have used with the print service of an
older UNIX system, it should still work. Be aware, though, that several –o options have
been standardized and will be passed to every interface program. These options may
interfere with similarly named options your interface program uses.
The printer interface scripts are associated with the printer model and are located in
/etc/lp/model. For example, the printer interface script for a PostScript printer is called
/etc/lp/model/PS. You can also create your own interface scripts or customize existing ones
to suit your needs. See Creating Printer Interface Scripts on page 6-11.
Interface scripts do the following:
Initialize the printer port (the connection between the computer and the printer). The
standard (/etc/lp/model/standard) interface script uses the stty command to initialize
the printer port.
Initialize the physical printer (restore the printer to a normal state in case a previously
printed file has left it in an unusual state), setting the character pitch, line pitch, page
size, and character set requested by the user. The standard interface script uses the
lp.set command to initialize the printer.
Print banner page (or pages), if required.
Print the requested files. The standard interface script calls the lp.cat command to print
the files.
Report any errors to the print service. The standard interface script uses the lp.tell
command to send descriptions of printer faults to the print service. The print service
forwards that information as an alert to the print administrator.
The print service opens the printer port. The print service gives the printer port connection to
the interface script as standard output and sets the printer to be the controlling terminal for
the interface script. If the port experiences a hangup, a SIGHUP signal is sent to the
interface script.
Many of the interface scripts provide special options that the user can specify by using the
–o option with the lp command.
The print service runs the interface script to send the print job to the printer, as shown in the
following example:
/etc/lp/interfaces/ printer id user title copies options file1 file2 ...
Arguments to the interface script are:
printer The name of the interface script (the same as the printer name).
id Request ID returned by the lp command.
user Login name of user who made the request.
title Optional title specified by the user.
copies Number of copies requested by the user.
options List of blank–separated options, specified by the user (using lp –o) or
by the print service (from default values specified by the administrator
with the lpadmin command). See the lp command for the list of
options recognized by the standard interface.
file Full path name of a file to be printed.