UNIX System Administration Handbook - Evi Nemeth [425]
You can assign two variables when adjusting the flag bits: fc and fs. fc (flag clear) specifies the bits that should be turned off, and fs (flag set) specifies the ones that should be turned on. Bits assigned to neither variable assume default values. It is meaningless to both set a bit and clear it.
The tty man page explains the meaning of each flag bit in detail. As long as you know the communication settings of your printer, setting the flag bits properly is trivial.
xc and xs: local mode bits
The local mode bits are useful only for serial line printers. The xc and xs variables clear and set individual mode bits in much the same way that fc and fs clear and set flags bits. The difference between the two sets of bits is that local mode bits configure the serial driver, whereas the flag bits configure the actual communication link. Most of the mode bits are intended for use on interactive video terminals and so are not relevant to printer configuration.
printcap extensions
A nice feature of the lpr/lpd system is that it does not mind if you supply values for nonstandard printcap variables. Often, when a particular printer needs more configuration information than the base system defines, you can put extra variables in printcap for the printer’s filters to use.
For example, the output filter for a network printer might need to know the network name of the device. The printcap entry for the printer might contain an entry such as
:nn=laser.colorado.edu:\
The use of printcap extensions allows all of the configuration information for a printer to be stored in one convenient place. If you see variables in the printcap file that are not discussed in the printcap manual page, check the documentation for the printer filters for the meanings of the variables.
Our site has taken advantage of this feature to document the physical location of each printer. Our printers have entries such as
:lo=Room 423, Engineering building:\
We have scripts that monitor paper and toner levels in the printers send mail to support staff with instructions such as “take more paper to room 423 in the Engineering building” when necessary. For more information about monitoring network devices, see Chapter 20, Network Management and Debugging.
Printing to something besides a printer
We recently saw an instance of “creative misuse” by Sean McCreary in which the BSD printing system was used to spool MP3 music to a software jukebox. If nothing else, this is a great testimonial to the flexibility of the printing system.
The printcap entry looked something like this:
mp3-local:\
:sd=/var/spool/lpd/mp3-local:\
:lf=/var/log/lpd-errs:\
:if=/usr/local/lib/mp3-play:\
:lp=/dev/null:\
:mx#0:
The actual MP3 player, amp, does not read from stdin by default, so a one-line script, called mp3-play, interfaced it to the printing system:
#!/bin/sh
exec /usr/local/bin/amp -
23.4 SYSTEM V PRINTING
Unfortunately, the System V printing software was not designed with network printing in mind, and it has not scaled well. Most vendors that use it have made numerous changes, some that add useful functionality, and some that are purely gratuitous.
Among our example systems, Solaris and HP-UX use the SysV software. However, both have modified it significantly. Below, we discuss the standard system with many vendor-specific notes.
Overview
A user who wants to print something must either use the lp command or a command that invokes lp indirectly. lp places input in a file in the spool directory appropriate for its final