This chapter describes how you set up and administer the files and programs that make up the Digital UNIX print services. You can set up and administer the print services immediately after a new installation or upgrade to a new version of the operating system, or you can wait until later. For example, you can wait until you have installed a printer and have gathered the information about its characteristics that you need to set it up.
The first part of this chapter describes how to use the lprsetup utility to add a print device and automatically set up the print environment. The second part of this chapter discusses the routine print services administration that you can perform, using either the lprsetup utility or by editing system files. The last part of this chapter contains detailed reference information about the lpd print daemon and the system files associated with the print services.
Note
You can also use the SysMan printconfig command to perform some of these tasks.
To set up the print system in a Digital UNIX operating environment, you perform tasks such as:
There are several ways you can administer print services:
Unless you are using the CDE Desktop Print Configuration application, you use the following commands to manage the print system:
Refer to the lprsetup(8), lpc(1), lpr(1), lprm(1), lpq(1), and lpstat(1) reference pages for more information about these commands.
After a printer is set up and running on your system, you need to:
This section describes the information you need in order to use the lprsetup utility to connect a printer to your computer. Before proceeding, verify that the printer is physically connected to your system, accessible on the network (for remote printing), and has been tested as described in the owner's manual.
To use the lprsetup utility, you must have the Printer Support Environment subset installed. To see if you have this subset installed, enter:
#
setld -i | grep OSFPRINT
If the OSFPRINT subset is installed, the following information is displayed:
OSFPRINT400 installed Local Printer Support (Printing Environment)
If the OSFPRINT subset is not installed, see the Installation Guide for information on adding this, or any, subset with the setld utility.
Before adding a printer, you need to gather the information about the printer that you will need to interact with the lprsetup program. The lprsetup program updates the information in the /etc/printcap file using the information you supply.
If your system is part of a network, you may need to consult your local network administrator about the correct procedure for adding a printer.
The following is a list of the information you need:
If you are adding a remote printer, you need the name of the machine the printer is connected to (host name) and the remote printer queue name.
The following sections describe how you obtain the required information.
The printer name is the name by which you want to identify the printer through the lpr command. For example:
#
lpr -Pprintername
The lprsetup program uses an internal numbering scheme from 0 to 99. The next available number is the default name. You can choose the default by pressing the Return key or by entering any other alphanumeric name that is appropriate. The lprsetup program always assigns at least two printer synonyms: the default number and 'lp default number', plus any others you specify. If the default number were 1, the two names would be '1' and 'lp1'. This printer could then be identified with 'lpr -P1' or 'lpr -Plp1'.
If you have only one printer or are entering the first of many printer names, the first name will have a printer number of 0. This is recognized as your system's default printer and will have an additional name of 'lp'. This means if you use the lpr command without specifying a specific printer this is the one it will use.
If this is the first printer connected to your system or a new printer added to an existing print system, create names that do not conflict with existing printer names. Ask your network administrator for the names of the remote printers on the network.
The printer type corresponds to the product name of the printer, such as the LN03 laser printer. If you are using the lprsetup program, printers are listed by type and only those supported by Digital are listed. These printers have some default values already included in the setup program.
The supported printer types are defined in Table 10-1.
Printer Name | Abbreviation |
LA50 | la50 |
LA70 Personal Printer | la70 |
LA75 Plus Companion Printer | la75 |
LA324 MultiPrinter | la324 |
LA424 MultiPrinter | la424 |
ColorMate PS | lf01r |
LG02 Line Printer | lg02 |
DEClaser 2200 | lg06 |
LG12 Impact Line Matrix Printer | lg12 |
LG31 Line Printer | lg31 |
LJ250 Companion Color Printer | lj250 |
LN03 Laser Printer | ln03 |
LN03 Laser Printer | ln03s |
DEClaser 2100 | ln05 |
DEClaser 2200 | ln06 |
DEClaser 1100 | ln07 |
DEClaser 3200 | ln08 |
DEClaser 5100 | ln09 |
LN03 PostScript Printer | ln03r |
DEClaser 2150 | ln05r |
DEClaser 2250 | ln06r |
DEClaser 1150 | ln07r |
DEClaser 3250 | ln08r |
DEClaser 5100 | ln08r |
IBM Proprinter | ibmpro |
NEC Silentwriter Model 290 | nec290 |
Epson FX-80 | fx80 |
Epson FX-1050 | fx1050 |
HP LaserJet Model IIP | hpIIP |
HP LaserJet Model IIIP | hpIIIP |
HP LaserJet Model IIID | hpIIID |
HP LaserJet Model IV | hpIV |
HP LaserJet Model 4M | hp4m |
any remote printer | remote |
default printer | unknown |
You can set up other printers by using 'unknown' and then responding to the prompts, using values similar to those for supported printers.
Responding with 'remote' allows you to designate a remote system for printing. In this case, only four printcap file entries are required:
The lp parameter must be present to print to a remote printer.
Responding with 'printer?' allows you to enter a mode where more information can be requested for each printer type. In this mode you are prompted to enter the same printer types as listed in the previous table. Information about the printer and the default printcap file entries for that printer are displayed. Enter 'quit' to return to the prompt to select the printer type being added.
When specifying the printer type, you must use full command names and printer names. The default printer type is 'unknown'.
To install third-party printers, consult the documentation that came with the printer.
The printer synonym is an alternate name for the printer. Some examples include 'draft', 'letter', and 'LA-75 Companion Printer'. You can enter as many alternate names for a printer as you like, but the total length of the line containing all the names must be less than 80 characters. When entering printer synonyms that can consist of many names, the entry process is terminated when you either enter a blank line or enter a line containing only white space.
After entering a synonym, you are prompted again. If you do not want to enter any more synonyms, press Return to continue.
Each synonym (including the printer number) identifies the printer to the print system. For example, if you chose the synonym 'draft' for a printer, the following command prints files on this printer:
$
lpr -Pdraft files
The device special file provides access to the port on the computer to which the printer is connected. The device special file is used if the printer is directly connected to a local serial or parallel port. In this case, you must equate a printer device logical name to the printer's device special file name by using the lp symbol in the /etc/printcap file. For example:
lp=/dev/lp
The installation procedure creates some device special files for the hardware that is connected to your computer. Usually, the device special files for parallel printers are named /dev/lpn (for example: lp1, lp2, lp3), and the device special files for serial line printers are named /dev/ttynn (for example: tty00, tty01, tty02). The n and nn variables specify the number of the printer.
When you use lprsetup, the program defaults to the next consecutive number when it sets up this file. For example, the default device pathname for the third serial line printer is /dev/tty03.
The default device special file is /dev/lp, which specifies a parallel printer.
For remote printers, you should specify a null argument with the lp symbol. For example:
lp=
Note
If the port is used for logins, the lprsetup script turns off the terminal line established by the getty process so the terminal line can be used for a printer.
The af parameter specifies the name of the accounting file used to keep track of the number of pages printed by each user for each printer. The name of the accounting file should be unique for each printer on your system. Use the pac program to summarize information stored in the printer accounting files. This file must be owned by user daemon and group daemon, which it will be if you use the lprsetup program to specify the printer accounting file.
The af parameter is not applicable for remote printer entries because the accounting policy for remote printers is employed at their (remote) systems.
Accounting is accomplished through programs called print filters. The lprsetup script does prompt you for the line print filter information. You must specify this information when you are prompted at the end of the lprsetup display for symbols to modify. Two print filter symbols, if and of, are needed for accounting. You modify them at this point. For example:
if=/usr/lbin/ln03rof of=/usr/lbin/ln03rof
If you want to use separate accounting files for each printer on your system, the file names must be unique. However, an unlimited number of printers can share an accounting file. You cannot specify an accounting file for remote printers.
Accounting files must be owned by the print daemon. If you specify an accounting file, intermediate directories are automatically created as needed.
Note
Printer accounting does not work for PostScript files.
The sd parameter specifies the spooling directory where files are queued before they are printed. Each spooling directory should be unique. All printcap file entries must specify a spooling directory, both local and remote.
When the spooling directory is created, intermediate directories are created as necessary.
The lf parameter specifies the log file where errors are reported. The default log file, if one is not specified, is /dev/console. If you have more than one printer on your system, give each log file a unique name.
When the error log file is created, intermediate directories in the pathname are created as necessary.
The ct parameter specifies the type of connection to the printer. You can connect a printer directly to your computer from a port or terminal line. You can access networked printers that are connected to a LAT (Local Area Transport) terminal server or to a remote host. If you are using lprsetup, the choices for the connection type are:
The lprsetup program supplies the default value dev.
The baud rate is the maximum rate at which data can travel between the data source and the printer (for example, 4800 or 9600). The default baud rate for your printer should appear in the printer documentation. If you reset this baud rate yourself during the installation of the printer hardware, the rate that you set on the printer must match the rate that you enter in the /etc/printcap file.
You specify a baud rate only for serial printers that are directly connected to your computer. Baud rates are not specified for printers connected to the console port or connected by a parallel port or LAT port.
This section describes how to install a printer locally (directly connected to your computer) using the lprsetup program. You can also use this program to modify a printer's configuration or remove a printer. These other tasks are described in Section 10.5.
Digital recommends that you accept the default values for an initial printer installation.
The printer described in the following example is an LN03R.
You can run the lprsetup program three ways:
You must have superuser privileges to run the lprsetup program. Depending on the type of printer you are adding and the information you provide, the lprsetup program might do the following:
When you run the lprsetup script, the first display is the main menu:
#
/usr/sbin/lprsetup
Digital UNIX Printer Setup Program
Command < add modify delete exit view quit help >:
The lprsetup command options are described in Table 10-2.
Command | Description |
add | Adds a printer |
modify | Modifies an existing printer's characteristics |
delete | Removes an existing printer from your configuration |
exit | Exits from the lprsetup program |
view | Displays the current /etc/printcap file entry for the printer you are configuring |
quit | Exits from the lprsetup program |
help | Displays online help about the lprsetup program |
You can abbreviate any command option with its initial letter.
You can enter information at each prompt or press Return to select the default information provided. (In most instances, you can accept the defaults.) You can also enter a question mark (?) to get a description of the information you specify at the prompt.
Note
Some of the symbols displayed in the lprsetup script are not supported by the Digital UNIX operating system. Refer to Table 10-4 and to the printcap(4) reference page for information on the supported symbols.
The following example shows how to use the lprsetup command to set up an LN03R printer to be used by the local system:
#
/usr/sbin/lprsetup
Digital UNIX Printer Setup ProgramCommand < add modify delete exit view quit help >: add
Enter printer name to add [0] : [Return]
Adding printer entry, type '?' for help.
or press RETURN for [unknown] : ln03r
For more information on the specific printer types enter `printer?'
Enter the FULL name of one of the following printer types:
la50 la70 la75 la324 la424 lg02 lg06 lg12 lg31 lj250 ln03 ln03s ln05 ln06 ln07 ln08 lf01r ln03r ln05r ln06r ln07r ln08r ibmpro nec290 fx80 fx1050 hpIIP hpIIIP hpIIID hpIV hp4m remote unknown
After you respond to each of the prompts, lprsetup prompts you to determine if you want to change any of the values assigned to the various symbols in your /etc/printcap file or if you want to specify any additional symbols. For example, you can set a specific page length or width. If you want to make any changes or add information, enter the appropriate symbol name. Refer to the printcap(4) reference page or Table 10-4 for more information on the various symbols.
Enter symbol name: q
Enter the name of the printcap symbol you wish to modify. Other valid entries are: 'q' to quit (no more changes) 'p' to print the symbols you have specified so far 'l' to list all of the possible symbols and defaults The names of the printcap symbols are:
af br cf ct df dn du fc ff fo fs gf ic if lf lo lp mc mx nc nf of op os pl pp ps pw px py rf rm rp rs rw sb sc sd sf sh st tf tr ts uv vf xc xf xs fo ic nc ps Da Dl It Lf Lu Ml Nu Or Ot Ps Sd Si Ss Ul Xf
Are these the final values for printer 0 ? [y] y
Printer #0 ---------- Symbol type value ------ ---- ----- af STR /usr/adm/lpacct br INT 9600 ct STR dev fc INT 0177777 fs INT 03 if STR /usr/lbin/ln03rof lf STR /usr/adm/lperr lp STR /dev/tty01 mc INT 20 mx INT 0 of STR /usr/lbin/ln03rof pl INT 66 pw INT 80 rw BOOL on sd STR /usr/spool/lpd xc INT 0177777 xf STR /usr/lbin/xf xs INT 044000
Next, the lprsetup script prompts you to add comments to the /etc/printcap file. Enter n at the prompt if you do not want to add comments. Enter y at the prompt if you want to add comments. At the pound sign (#) prompt, enter your comment. Press Return at the pound sign (#) prompt to exit. The comments will be insert directly above the printcap entry in the /etc/printcap file.
Do you want to add comments to the printcap file [n] ? : y
Adding comments to printcap file for new printer, type '?' for help.
Command < add modify delete exit view quit help >: view
Set up activity is complete for this printer. Verify that the printer works properly by using the lpr(1) command to send files to the printer.
# Use this printer for draft-only pearly|lp0|3X27|tomw:\ :af=/usr/adm/lpacct:\ :br#9600:\ :ct=dev:\ :fc#0177777:\ :fs#03:\ :if=/usr/lbin/ln03rof:\ :lf=/usr/adm/lperr:\ :lp=/dev/tty01:\ :mc#20:\ :mx#0:\ :of=/usr/lbin/ln03rof:\ :pl#66:\ :pw#80:\ :rw:\ :sd=/usr/spool/lpd:\ :xc#0177777:\ :xf=/usr/lbin/xf:\ :xs#044000:
Command < add modify delete exit view quit help >:
exit
Refer to the lprsetup(8) reference page for more information on using the program.
You can use the lprsetup script to set up remote printers that are accessible from a Local Area Transport (LAT) or from a remote machine.
If you are setting up a remote printer from a remote machine, the local machine (the client) must be listed in the \.rhosts file of the remote machine (the host).
If your printer will be connected to a remote LAT terminal server, ensure that the LAT subsets are installed as described in the Installation Guide. To see if the LAT subsets are installed, enter:
#
setld -i | grep OSFLAT
See the Network Administration guide for information on how to enable remote LAT terminal server printing. docroff: ignoring superfluous symbol print_lat_setup
Test your printer by using the lpr command to print a few pages of text. You should also test any special printer features that you intend to use regularly on this printer, for example, PostScript or double-sided print. Refer to the lpr(1) reference page for more information on how to invoke these features. Table 10-4 lists the printcap symbol names, the type of values they take, default values, and descriptions.
The lptest command writes a traditional ripple test pattern to the standard output, or you can direct the output to a printer. A pattern that contains all 96 printable ASCII characters in each column is printed using 96 lines. In the pattern, each printed character is displaced rightward one character column on each successive line. This test is also useful for ascertaining the number of lines per page and the default page parameters. You can use the ripple test pattern to test printers, terminals, and drive terminal ports during debugging.
The lptest command has the following syntax:
/usr/sbin/lptest [ length [ count ] ]
Use the lptest command if you need quick output of random data. For example:
#
/usr/sbin/lptest |lpr -P3r44
Refer to the lptest(8) reference page for more information.
The first part of this chapter showed you how to set up the first printer on a system. This section describes the routine administrative tasks for a print system that is already set up. You can use the lprsetup script to perform these tasks. You can also perform the tasks manually by editing system files and creating files and directories. If you are making many changes to the print system at one time, it may be easier for you to make the changes manually. The tasks described in the following sections are:
Note that if you manually remove printers from the /etc/printcap file, you also have to remove spooling, accounting, and error directories and files.
Once you have one printer set up, you can add other printers at any time. Gather the following information about each printer:
You can add printers by running the lprsetup command or you can add printers manually by performing the following steps:
You should make sure that the /etc/inittab file does not invoke the getty process on serial lines that have printers attached. If you use the lprsetup script, this is done for you.
To modify a printer's configuration automatically, run the lprsetup program and choose the modify option from the main menu. Section 10.4.2 describes how to use the lprsetup program.
If you change the name of the spooling directory, the accounting file, or the error log file, lprsetup asks you to verify that the information is correct before it deletes the original information.
To manually modify a printer's configuration, edit the /etc/printcap file and modify the entry that pertains to the printer. Refer to Section 10.6.3 and to the printcap(4) reference page for information about the /etc/printcap file symbols.
To remove a printer, run the lprsetup program and choose the delete option from the main menu. The program prompts you for the printer name. Enter the name of the printer you want to remove. You are prompted for confirmation that you want to delete the error log file and the accounting file because these files can be shared by more than one printer. If you do have shared files, do not delete them. Section 10.4.2 describes how to use the lprsetup program.
If you have included comments for the printer in the first line of its /etc/printcap file entry, the lprsetup program does not delete them. You must edit the /etc/printcap file and delete the comments.
To manually remove a printer, edit the /etc/printcap file and delete the entry that pertains to the printer. You must also manually delete the accounting and log file and the spooling directory.
Printer accounting allows you to charge users for printing services and to determine the amount of printer usage.
There are two types of printer accounting: printer user accounting and printer summary accounting. Printer user accounting provides information about printer use according to the machine and user name that issues the print request. Printer summary accounting provides information about the amount of media (number of printed pages or number of feet of roll paper or film) the printer produces. You specify the pac command with the -s option to produce printer summary accounting information.
The printer accounting files default to the /var/adm directory. If you use the lprsetup program to add a printer, the program creates the accounting file you specify. The /usr/adm/lpacct file is the default accounting file. If you add a printer manually, you must create the accounting file.
Note
The /var/adm/printer directory should be owned by user adm and belong to group adm.
The printer accounting files should have protection mode 644, be owned by user adm, and belong to group system.
Refer to Chapter 12 for more information on using printer accounting.
Use the lpc command to manage the print jobs and queues associated with the local printers on your system. You can use the lpc command to:
Some lpc commands, for example, the disable command, require you to be superuser.
Note
You can use the lpc command only to manage print queues that are local to your system. Although a remote printer has both a local queue and a remote queue, the lpc command manages only the local queue.
There are 15 command arguments that you can specify with the lpc command. You can also use the lpc command interactively. If you enter the lpc command without any command arguments, the lpc> prompt is displayed. You can then enter command arguments.
The lpc command has the following syntax:
/usr/sbin/lpc [ argument ] [ all | printer... ]
Some of the command arguments allow you to specify all to indicate all the printers or to specify one or more printer variables to indicate a specific printer.
You can specify the argument variables defined in Table 10-3.
lpc Argument | Description |
help [argument] | Prints a one-line description of the specified lpc command argument. If an argument variable is not specified, the list of arguments is displayed. |
? [argument] | Same as the help argument. |
abort | Terminates an active lpd daemon and then disables printing. This prevents the lpr or lp command from starting a new lpd daemon. |
clean | Removes any temporary files, data files, and control files that cannot be printed (for example, files that do not form a complete printer job) from the specified print spooling directory. |
disable | Turns off the specified print spooling queue. This prevents the lpr or lp command from entering new jobs in the queue. |
down message... | Turns off the specified print queue, disables printing, and enters the specified message in the printer status file. The message does not need to be quoted because remaining arguments are treated the same as echo. You can use the down argument to take down a printer and inform users. If a printer is down, the lpq command indicates that the printer is down. |
enable | Enables spooling for the specified printers. This enables the lpr or the lp command to enter print jobs in the spooling queue. |
exit | Exits from lpc. |
quit | Exits from lpc. |
restart | Attempts to start a new lpd daemon for the specified printer. This argument is useful if some abnormal condition causes the daemon to terminate unexpectedly and leave jobs in the queue. If this occurs, the lpq command indicates that no daemon is present. If a daemon is hung, you must first kill the process and then restart the daemon by using the restart argument. |
start | Enables printing and starts a spooling daemon for the specified printer. |
status [printer] | Displays the status of the specified printer daemon and queue. The status argument shows if the queue is enabled, if printing is enabled, the number of entries in the queue, and the status of the printer's lpd daemon. If a printer name is not supplied, information about all printer daemons and queues is displayed. |
stop | Stops a spooling daemon after the current job is complete and disables printing. |
topq printer | Puts print jobs in the queue in the specified order. You can specify the print jobs by also specifying a request_ID variable or a username variable. |
up | Enables all printing and starts a new printer daemon. Cancels the down argument. |
The following example shows that the lpd daemon is active on the printer named tester and there is one entry in the queue:
#
/usr/sbin/lpc
lpc>
status tester
tester: printer is on device '/dev/tty02' speed 9600 queuing is enabled printing is enabled 1 entry in spool area lpc>
Refer to the lpc(8) reference page for more information.
This section contains information about the line printer daemon, lpd, and the system files that are required for print system operations. These files are created automatically if you use the lprsetup script, as described in Section 10.4.2, or you can create and modify the files manually. Note that if you create files manually, you will also need to manually change the /etc/printcap file, so the changes can take effect.
Printers are controlled by the line printer daemon, lpd, which is located in the /usr/lbin directory. Printing cannot take place unless the lpd daemon is running. The lpd daemon has many functions:
When you use the lpr command, the lpd daemon is activated, and the daemon copies the file to the printer's spooling queue or directory. Requests are printed in the order in which they enter the queue. A copy of the file to be printed remains in the queue until the printer is ready to print it; then the lpd daemon removes the file from the spooling queue and sends it to the printer.
After you install and boot your system, the lpd daemon is usually started by the init program. You can start the lpd daemon with the following command syntax:
/usr/lbin/lpd [ -l ]
The -l option causes the lpd daemon to log valid requests from the network. This option is useful for debugging.
To test whether the line printer daemon is running, enter:
#
ps agx |grep /usr/sbin/lpd
Each printer must have its own spooling directory located under the /usr/spool/lpd directory. The spooling directory acts as a printer's spooling queue; it contains the files that are queued for printing on that printer. A printer spooling directory should have the same name as the printer reference name and must be located on the machine attached to the printer. The printer reference name is the name that you specify to print on a particular printer.
If you are using lprsetup, the program supplies the default value /usr/spool/lpdn. The n variable specifies the printer number. For example, the default name of the spooling directory for a second line printer could be /usr/spool/lpd2. The default spooling directory for any printer is /usr/spool/lpd.
Each printer entry in the /etc/printcap file should specify a spooling directory even if the printer is connected to another machine or is on another network. You specify a spooling directory with the sd symbol. For example:
sd=/usr/spool/lpd/purple
Spooling directories must have the same parent directory name, which is normally /usr/spool.
A spooling directory contains a status file and a lock file that are created by the lpd daemon when a file is queued for printing. The lock file contains control information about the current print process. For example, it can inform the lpd daemon that the printer is printing a job. The lock file prevents the lpd daemon from invoking another job on the printer while a file is printing. The lock file contains the process identification number of the daemon that is currently running. The status file contains a line that describes the current printer status. This line is displayed if a user inquires about printer status. If a printer whose status is queried is not active, the status message written to standard output is no entries.
When the lpd daemon is activated as a result of a print request, it looks in the printer spooling directory for a lock file. If a lock file is not found, the lpd daemon creates one and writes the identification number and the control file name on two successive lines in the file. The lpd daemon then scans the printer spooling directory for command files whose names begin with cf. Command files specify the names of user files to be printed and contain printing instructions for the files. Each line in a command file begins with a key character that indicates what to do with the remainder of the line. The key characters and their meanings are described in detail in the lpd(8) reference page.
Data files, whose names begin with df, are also located in the spooling directory. Data files contain text formated for printing. These files are identified by their print request identification numbers only.
After a file is printed, the lpd daemon removes the control and data files from the printer spooling queue, updates the status file, and sets up the next file in the spooling queue for printing.
For example, if a printer named milhaus has jobs currently waiting to be printed, the following command lists the files that are stored in the spooling directory:
#
ls -l /var/spool/lpd/milhaus
-rw-rw---- 1 root 75 Jan 17 09:57 cfA0220mothra -rw-rw---- 1 root 96 Jan 17 10:03 cfA143harald -rw-rw---- 1 root 199719 Jan 17 09:57 dfA0220mothra -rw-rw---- 1 root 9489 Jan 17 10:03 dfA143harald -rw-r--r-- 1 root 20 Jan 17 10:06 lock -rw-rw-rw- 1 daemon 113 Jan 17 10:00 status
If you want to manually add a printer, use the mkdir command to create the spooling directories for each printer. The spooling directory permission mode must be set to 775. The directory's group and ownership must be set to the name daemon. For example:
#
cd /var/spool/lpd
#
mkdir lp1
#
chmod 775 lp1
#
chgrp daemon lp1
#
chown daemon lp1
#
ls -l lp1
drwxr-xr-x 2 daemon daemon 24 Jan 12 1994 lp1
The lpd daemon uses the /etc/printcap printer database file to print requests. Each entry in the file describes a printer. Printer characteristics are specified by 2-letter abbreviations called symbols. The symbols are described in this section and in the printcap(4) reference page. The lprsetup program modifies the /etc/printcap file.
The following example shows an /etc/printcap entry for both a local printer and a remote printer:
# # lp|lp0|0|dotmatrix|mary:\ :af=/usr/adm/printer/lp.acct:\ :br#9600:\ :ct=dev:\ :fc#0177777:\ :fs#023:\ :if=/usr/lbin/la75of:\ :lf=/usr/adm/lperr:\ [1] :lp=/dev/tty01:\ :mx#0:\ :of=/usr/lbin/la75of:\ :pl#66:\ :pw#80:\ :sb:\ [2] :sd=/usr/spool/lpd:\ :xc#0177777:\ [3] :xf=/usr/lbin/xf:\ :xs#044000:\ # # sqirrl|3r3|ln03r3|postscript3|In office 2T20:\
:lp=:rm=uptown:rp=lp:sd=/var/spool/printer/ln03r3:mx#0:\ [4] #
The callouts in the /etc/printcap entry show the following possible symbol syntaxes:
The first line of a printer entry contains the fields that specify the printer primary reference name and printer name synonyms. This first line and these fields are required for every printer, both local and remote.
The printer reference name is the name that you subsequently use in order to specify printing to this printer. You can give each printer as many alternative reference names as you want, but each field on the first line must be separated with a vertical bar (|). The first line must end with a colon (:).
Note
A local printer entry in the /etc/printcap file should have the default printer reference name lp0 so that print jobs can have a destination when printer reference names are not specified in print commands.
The remaining lines of each printer entry contain the descriptive symbols and values that define the printer's configuration. Symbols are 2-character mnemonics and can be specified with an equal sign (=) and alphabetic characters or with a number sign (#) and a numeric value. Some symbol names have Boolean equivalents, which do not use parameters. You can specify the symbols on one line or on individual lines, but you must separate them with colons (:).
To make the /etc/printcap file easy to read, you can place a colon (:) at the beginning of a line and a backslash (/\) at the end of a line to separate the symbols.
Table 10-4 lists the printcap symbol names, the type of values they take, default values, and descriptions.
Symbol | Type | Default | Description |
af | alphabetic | NULL | Name of accounting file |
br | numeric | none | If lp is a tty, set the baud rate (ioctl call) |
cf | alphabetic | NULL | The cifplot data output filter |
ct | alphabetic | NULL |
Connection type |
df | alphabetic | NULL | The TeX data filter (DVI format) |
dn | alphabetic | /usr/lbin/lpd | Specifies a nonstandard daemon pathname |
du | numeric | none | Specifies a nonstandard daemon UID |
fc | numeric | 0 | If lp is a tty, clear flag bits (sgtty.h) |
ff | alphabetic | /f | String to send for a form feed |
fo | Boolean | false | Print a form feed when device is opened (to suppress all form feeds, specify both the fo and sf symbols) |
fs | numeric | 0 | If lp is a tty, set flag bits |
gf | alphabetic | NULL | Graph data filter (plot format) |
ic | Boolean | false | Driver supports (nonstandard) ioctl to independent printout |
if | alphabetic | NULL | Accounting text filter |
lf | alphabetic | /dev/console | Error log file name |
lo | alphabetic | lock | Name of lock file |
lp | alphabetic | /dev/lp |
Printer device logical name |
mc | numeric | 20 | Specifies the maximum number of copies allowed |
mx | numeric | 1000 | Maximum file size (in BUFSIZ blocks), zero (0) removes size restriction |
nf | alphabetic | NULL | The ditroff data filter (device independent troff) |
of | alphabetic | NULL | Output filtering program |
op | alphabetic | NULL | Entry in the reference name field for LAT port characteristics |
Table notes:
When the printer is connected directly to a local port, a device connection is used. You define a printer device special file name for the lp symbol.
Symbol | Type | Default | Description |
os | alphabetic | NULL | Service name supported on some terminal servers |
pl | numeric | 66 | Page length (in lines) |
pp | alphabetic | NULL | The print command filter replacement |
ps | alphabetic | non_PS | Indicates that the printer is PostScript |
pw | numeric | 132 | Page width (in characters) |
px | numeric | 0 | Page width in pixels (horizontal) |
py | numeric | 0 | Page length in pixels (vertical) |
rf | alphabetic | NULL | The FORTRAN-style text file filter |
rm | alphabetic | NULL |
Machine name for remote printer |
rp | alphabetic | lp | Remote printer name argument |
rs | Boolean | false | Restrict remote users to those with local accounts |
rw | Boolean | false | Open the printer device for reading and writing |
sb | Boolean | false | One-line banner |
sc | Boolean | false | Suppress multiple copies |
sd | alphabetic | /usr/spool/lpd | Spool directory |
sf | Boolean | false | Suppress all form feeds, except those that are in the file |
sh | Boolean | false | Suppress printing of burst page header |
st | alphabetic | status | The status file name |
tf | alphabetic | NULL | The troff data filter (catphototypesetter) |
tr | alphabetic | NULL | Print trailing string if queue empties (the trailing string can be a series of form feeds or an escape sequence) |
ts | alphabetic | NULL | LAT terminal server node name. |
vf | alphabetic | NULL | The raster image filter (you can also specify raster filters with the if and of symbols) |
xc | numeric | 0 | If lp is a tty, clear local mode bits (tty) |
xs | numeric | 0 | If lp is a tty, set local mode bits |
Table notes:
The filter directory for the lpd daemon translates data that you want to print into the format appropriate for your printer. You must specify the filter that matches each printer on your system. For example, to print files with the LN03R printer, you would use the ln03rof filter.
You can specify an accounting filter with the if symbols and an output filter with the of symbol. Output filters filter text data to the printer device if accounting is not enabled or if text data must be passed through a filter. For example:
if=/usr/lbin/ln03rof of=/usr/lbin/ln03rof
Refer to the lpd(8) reference page for more information on using filter capabilities.
Table 10-6 lists the available print filters located in the /usr/lbin directory.
Filter Name | Description |
epsonof | Epson FX-80 and FX-1050 printers |
hplaserof | NEC Silentwriter Model 290 and most Hewlett Packard LaserJets |
hplaserpsof | Hewlett Packard PostScript-equipped LaserJets |
hplaser4psof | Hewlett Packard LaserJet Model 4M only |
lpf | Line printer filter (LP25, LP26, LP27, LP29, LG01, LA210, LQP02, LQP03) |
lqf | Letter-quality filter (LQP02, LQP03) |
la75of | Dot matrix printer filter (LA75, LA70, LA324, LA424) |
lg31of | LG31 line printer filter |
lg02of | LG02 ink jet printer filter |
ln03of | LN03 laser printer filter |
ln03rof | LN03 ScriptPrinter filter |
ln03rof_isolatin1 | LN03 ScriptPrinter filter with ISO Latin_1 encoding |
ln03rof_decmcs | LN03 ScriptPrinter filter with DEC multinational character set encoding |
ln05of | DEClaser 2100 laser printer filter |
ln05rof | DEClaser 2150 PostScript printer filter |
ln05rof_isolatin1 | DEClaser 2150 PostScript printer filter with ISO Latin_1 encoding |
ln05rof_decmcs | DEClaser 2150 PostScript printer filter with DEC multinational character set encoding |
Filter Name | Description |
ln06of | DEClaser 2200 laser printer filter |
ln06rof | DEClaser 2250 PostScript printer filter |
ln06rof_isolatin1 | DEClaser 2250 PostScript printer filter with ISO Latin_1 encoding |
ln06rof_decmcs | DEClaser 2250 PostScript printer filter with DEC multinational character set encoding |
ln07of | DEClaser 1100 laser printer filter |
ln07rof | DEClaser 1150 PostScript printer filter |
ln07rof_isolatin1 | DEClaser 1150 PostScript printer filter with ISO Latin_1 encoding |
ln07rof_decmcs | DEClaser 1150 PostScript printer filter with DEC multinational character set encoding |
ln08of | DEClaser 3200 laser printer filter |
ln08rof | DEClaser 3250 PostScript printer filter |
ln08rof_isolatin1 | DEClaser 3250 PostScript printer filter with ISO Latin_1 encoding |
ln08rof_decmcs | DEClaser 3250 PostScript printer filter with DEC multinational character set encoding |
ln09of | DEClaser 5100 PostScript printer filter |
ln09of_isolatin1 | DEClaser 5100 PostScript printer with ISO Latin_1 encoding |
ln09of_decmcc | DEClaser 5100 PostScript printer with DEC multinational character set encoding |
lj250of | LJ250 DEColorwriter filter |
For printers not supplied by Digital, consult your printer manual for filter information.
Flag bits specify characteristics about data transmission from the host to the printer and, if possible, from the printer to the host on a serial line only (LAT and RS232). Data that is passed from the printer to the host may include stop and start status information, which tells the host that the printer input buffer can accept input or that it is about to overflow.
Delays are specific times used to slow the transmission of the next group of characters to the input buffer. Delays give the printer mechanism time to perform operations such as a carriage return, newline, tab, and form feed.
Flag bits are cleared with the fc symbol and set with the fs symbol. All printers do not use all the flag bits, but you must either set the bits or clear them. You should consult your printer manual for specific information about flag bits.
The flag bits are specified as octal numbers in a 16-bit word. Octal values are preceded with the number zero (0). To clear all the bits, specify the value 0177777 with the fc symbol. To set all the bits, specify the value 0177777 with the fs symbol. All bits should be cleared (using fc#0177777) before calling the fs symbol. To set or clear any groups of bits, specify the octal sum of the combined bits for the number of flag bits.
The following is an example of flag bit specifications:
fc#0177777 fs#0141
As shown in the previous example, fc#0177777 clears all bits. The fs symbol set to 0141 specifies the OPOST, ONLRET, and OFILL flag bits.
Table 10-8 lists each flag bit name, its octal value, and its description.
Flag | Octal Value | Description |
OPOST | 0000001 | Enable output processing |
ONLCR | 0000002 | Map NL to CR-NL |
OLCUC | 0000004 | Map lower case to upper case |
OCRNL | 0000010 | Map CR to NL |
ONOCR | 0000020 | No CR output at column 0 |
ONLRET | 0000040 | NL performs CR function |
OFILL | 0000100 | Use fill characters for delay |
OFDEL | 0000200 | Fill is DEL, else NUL |
NLDLY | 0001400 | Newline delay |
NL0 | 0000000 | |
NL1 | 0000400 | |
NL2 | 0001000 | |
NL3 | 0001400 | |
TABDLY | 0006000 | Horizontal tab delay |
TAB0 | 0000000 | |
TAB1 | 0002000 | |
TAB2 | 0004000 | |
TAB4 | 0006000 | |
CRDLY | 0030000 | Carriage Return delay |
CR0 | 0000000 | |
CR1 | 0010000 | |
CR2 | 0020000 | |
CR3 | 0030000 | |
FFDLY | 0040000 | Form feed delay |
FF0 | 0000000 | |
FF1 | 0040000 | |
BSDLY | 0100000 | Backspace delay |
BS0 | 0000000 | |
BS1 | 0100000 | |
OXTABS | 1000000 | Expand tabs to spaces |
Refer to the tty(7) reference page for detailed information on flag bits.
Mode bits specify details about the capability of a particular terminal and usually do not affect printer operation. Mode bits are cleared with the xc symbol and set with the xs symbol. Some printers use all of the mode bits, so you must either set them or clear them. The mode bits are specified as octal numbers in a 16-bit word format. You should clear all bits by specifying xc#0177777 before you specify the xs symbol.
Refer to the tty(7) reference page for a detailed description of the status bits.
The following is an example of mode bits specifications:
xc#0177777 xs#044000
As shown in the previous example, xc#0177777 clears all bits. The xs symbol set to 0110 specifies the ECHO and ECHOCTL mode bits.
Table 10-9 lists a description of each mode bit.
Mode | Octal Value | Description |
ECHOKE | 0000001 | Echos KILL by erasing the line |
ECHOE | 0000002 | Visually erase characters |
ECHOK | 0000004 | Echoes NL after KILL |
ECHO | 0000010 | Enable echoing |
ECHONL | 0000020 | Echoes NL even if ECHO is off |
ECHOPRT | 0000040 | Echo erased chars between and / |
ECHOCTL | 0000100 | Echo control characters as ^(char) |
ISIG | 0000200 | Enable special chars INTR, QUIT and SUSP |
ICANON | 0000400 | Enable canonical input |
ALTWERASE | 0001000 | Use alternate word erase algorithm |
IEXTEN | 0002000 | Enable FLUSHO and LNEXT |
XCASE | 0040000 | Canonical upper/lower presentation |
If a printer will be used by users on remote machines, /etc/printcap files on the local machine attached to the printer and on the remote machines that will use the printer must contain some network configuration information.
On the local machine attached to the printer you must specify the rs symbol, which specifies a Boolean value that takes only a true (yes) or false (no) value, along with the other printer configuration symbols. If you define the value as true, remote users must have an account on the local machine that is attached to the printer. If you define the value as false, remote users can access the local printer if the local printer is listed in the \.hosts file. Refer to Section 10.6.3 for an example of an /etc/printcap file.
On the remote machine that will use the printer, you must specify the rm, rp, lp, and sd symbols.
The rm symbol specifies the name of the machine attached to the printer. For example:
rm=deccom
The rp symbol specifies the printer spool name on the remote system. For example:
rp=ln03lab
For remote printers, you should specify the lp symbol without a value:
lp=
The sd symbol specifies the spooling directory. For example:
sd=/usr/spool/lpd
Printer filters must know the size of an output page to perform proper page framing and line-feed and carriage returns (line folding).
For line printers, the pl and pw parameters specify the page length in number of lines (default is 66) and the column width in number of constant-width characters (default is 132), respectively. For example:
pl#55 pw#70
You should not specify a width of more than 80 characters for a letter-quality printer that uses 8 1/2-inch by 11-inch paper. If you specify a width that is greater than 80 characters on a printer, the page prints in landscape mode.
For high-resolution laser-type printers, the line length and page width parameters are py and px, which specify the number of pixels along the y- and x-coordinate planes of the printer output image area. Some printers can operate in either constant-width or imaging modes, so you must specify both sets of parameters. For example:
px#60 py#80
Refer to your printer's manual for its output characteristics.
This section provides a checklist for diagnosing printer problems. It also describes how print errors are logged in the /usr/adm/lperr file, providing this feature is specified in the /etc/printcap file.
If a problem occurs on an existing printer or when adding a printer to a system, diagnose the problem as follows:
#
ps agx |grep /usr/sbin/lpd
If the daemon is not running, restart it by using the following commands:
#
rm -f /dev/printer /var/spool/lpd.lock
#
/usr/lbin/lpd -l
The first command removes the /dev/printer and /var/spool/lpd.lock files. In the second command, the -l option causes the daemon to log requests from the network. This flag is useful for debugging problems with remote printers.
The lpd daemon logs printer errors to the error log file. Specifying an error log file is optional. If you used lprsetup to install the printer, the program provides the default value /usr/adm/lperr. If you do not specify an error log file, errors are logged to /dev/console.
The error log file is specified with the lf symbol in the /etc/printcap file. For example:
lf=/var/adm/lpderrs
Error log files are usually located in the /var/adm directory. An error log file can be shared by all local printers, but you should specify the file in each /etc/printcap file printer entry.