SUMMARY BSD: printcap filters

From: Clive Haworth (
Date: Sat Jul 01 1995 - 05:23:10 CDT

X-Sun-Data-Type: text
X-Sun-Data-Description: text
X-Sun-Data-Name: text
X-Sun-Charset: us-ascii
X-Sun-Content-Lines: 39

} Subject: BSD printcaps
} Hi out there.
} Could somebody please explain to me the difference
} between an lpd INPUT filter (if) and OUTPUT filter (of)
} and, if specific filters eg. (vf) are included in the
} printcap file, what order everything happens in ?
} And what about pr - does the output filter still get run
} as well ?
} What constraints are there on filters, do they need to
} respond to certain signals, recognise special character
} sequences ?
} Can I get my hands on some concise documentation ?

Got two responses.

First was from Jeff Greer (
He sent me the Printing-HOWTO document attached.

Second was Don Lewis (

who suggested lookng at the BSD NET-2, 4.4BSD, FreeBSD, or NetBSD
ftp sites for info.

Well I attacked

and found the second attachment.

There's enough in this to let me know what I want.

Thanks to all that responded.

Clive Haworth
X-Sun-Data-Type: default
X-Sun-Data-Name: Printing-HOWTO
X-Sun-Charset: us-ascii
X-Sun-Content-Lines: 2625

                       The Linux Printing-HOWTO

               A guide to printing and previewing files
               under the Linux operating system.

         Copyright (C) 1994 by Grant Taylor and Brian McCauley


1 Intro
2 Printing software
2.1 text
2.2 pr
2.3 PostScript
2.4 fonts
2.5 faxing
2.6 *roff, man pages
2.7 Printing text via PostScript
2.7.1 mpage
2.7.2 a2ps
2.7.3 enscript
2.7.4 gslp
2.8 PostScript utilities
2.9 TeX/dvi
2.9.1 `dvips'
2.9.2 `eps'
2.9.3 `dvilj'
2.10 texinfo
2.11 Printing though a terminal
2.12 hardware and drivers
2.13 Printer device names
3.1 Setting up print services
3.1.1 Remote Printing Vs. Local Printing
3.1.2 What You Need
3.1.3 How Printing Works Under Linux
3.1.4 The important programs
3.1.5 The `lpr' Command
3.1.6 The `lpq' Command
3.1.7 The `lprm' Command
3.1.8 The `lpc' Command
3.1.9 The Important Directories
3.1.10 The Important Files
3.1.11 More About /etc/printcap
3.1.12 Fields in `/etc/printcap'
3.1.13 More on The `lp' Field
3.1.14 More On The lf Field
3.1.15 More On The if Field
3.1.16 More On The `rm' and `rp' Fields
3.1.17 More On The `sh' and `sf' Fields
3.1.18 More On The `mx' Field
3.1.19 A Test Printcap Entry
3.1.20 Putting It All Together
3.1.21 More On Remote Printing
3.1.22 The Fiddly Bits
3.1.23 Troubleshooting
3.2 What lpr and lpd do
3.3 Getting hold of lpd
3.4 Where Do The Files Go And What Should Their Permissions Be?
3.5 lpd not working
3.6 Where Do I Get A Printcap For Printer Model xxxxx?
3.7 The Semantics of `/etc/printcap'
3.8 The Syntax of `/etc/printcap'
3.9 An `/etc/printcap' gotcha
3.10 The Minimum /etc/printcap
3.11 How to prevent the `Staircase Effect'
3.12 Resetting the printer between each file printed
3.13 Preventing formfeed after each file printed
3.14 Printing with lpd to a serial port
3.15 cat works to the serial port, but not lpd (1)
3.16 Printers that are not simple devices
3.17 Generating burst or banner pages
3.18 Spooling text to a PostScript printer
3.19 Why graphics files are sometines truncated
3.20 Why `lpr -i' doesn't work
3.21 Why `lpr -p' doesn't work?
3.22 `lpc' and `lpq' warning of missing daemons
3.23 Using `lpr' over a network
3.24 Writing lpd filters
3.25 Debuging lpd filters
3.26 Output (`of') filters
3.27 Getting filters for given printers
3.28 Filters from programs that won't read STDIN
3.29 Having many filters
3.30 Magic Filters
3.31 Magic Filter Examples
4 Previewing
4.1 ghostview
4.2 gspreview
4.3 xdvi
4.4 xtex
4.5 gxditview
4.6 non-X previewing
5 Ascii Translation
5.1 from TeX
5.2 from dvi
5.3 from PostScript
5.4 from troff
5.5 from ascii/latin1

1 Intro

   This is the Printing HOWTO for Linux. This is a member of the second
generation of Linux FAQs. The original Linux FAQ gradually became a
monolithic beast, and has now been re-written in a new syle, refering to
HOWTOs for details. This HOWTO details how to properly set up most
types of printers, how to configure software to make them print well,
what types of fax software are available, and how to preview many types
of printable output. It was originally written by Grant Taylor
<> and later incorporated the lpd-FAQ by Brian
McCauley <>. Other HOWTOs detail networking,
kernel hacking, etc. All HOWTOs are found in several places, the
official location being:

   Like just about any usenet FAQs they can also be found on

   Please send comments, bug reports, etc, to
<>. This address goes to both Brian and

   If you know anything or can point us towards any useful programs not
in this document that should be, please let us know!

   Grant has a mail server set up on his machine. It stores documents
and other things related to printing and previewing with Linux,
including the latest and greatest version of this document. At some
point in the future this will probably be superceded by our own
directory on one of the major ftp servers. Mail to
<> with a body of `info' will have you sent a
list of available files. A body of `get file1 [file2 file3... ]' will
send you specific files.

   Summary of changes

   * Now in texinfo! Available from sunsite in texinfo, dvi and text
     forms. The info form may be read in emacs but less you are a real
     emacsphile or don't have X then you'd probably be better off using

     `tkinfo' is available by anonymous ftp from:

     The ptolemy site will always have the latest version.

   * New mailserver info.

   * Much dead-wood removed.

   * Attributions on individual sections do not appear in the final
     version although they do in the texinfo source.

   * Assorted little changes

   * Incorporated Karl Auer's <> document. This is
     still not seemless so you'll likely find some duplication and
     missing cross references - please let us know.

2 Printing software

   These sections describe printing software known to be available for
Linux. Note that most Un*x printing software can be easily compiled
under Linux.

2.1 text

   Under Linux, or under most any Un*x operating system, the easiest
thing to print with most printers is plain ASCII. Any way you can
arrange to send the text to the printer is perfectly valid. If you
have a serial printer, then try devices `/dev/ttyS?', `/dev/ttys?',
`/dev/cua?', etc, and if you have a regular parallel hookup, use
`/dev/lp?'. Typing `cat FILE >/dev/????' should do it. You may need
root privileges, or you may wish to chmod your printer device if this
is all you ever print. (Note the security hole there if you've more
than one user) Some printers (ie, HP DeskJet) want dos-style end of
lines: newline+carriage return. These printers will show the
'staircase effect'. See Also: The staircase effect.

2.2 pr

   Most plain ascii files in the un*x world have a tendency to be just
that - plain, unformatted ascii with no page breaks or anything else to
make a printed copy look nice and not have lines printed over
perferations. The answer to this problem is to run your text through a
formatter such as pr. Pr is a standard un*x utility designed to format
plain text for printing on a line printer. The usual appearance of the
resulting formatted text has a header and/or footer, page numbers, the
date, possibly margins, double spacing, etc. As is common with un*x
utils, pr has a bazillion options. They are detailed in the man page.

2.3 PostScript

   Printing almost anything other than plain text under Un*x usually
involves the ability to print PostScript. If you have a PostScript
printer, you're all set. But for most, this is not so easy.

   The established way to interpret PostScript under Linux is to use
ghostscript, which, like nearly everything else, comes from the GNU
project. Ghostscript is a PostScript interpreter which accepts
PostScript input and generates output appropriate for X displays, most
printers, some specialized display hardware, and fax software.

   The following devices are available as of ghostscript 2.6.1pl4:
             linux PC vga using linux svgalib
     # x11 X Windows version 11, release >=4 [Unix and VMS only]
     # Printers:
     # * appledmp Apple Dot Matrix Printer (Imagewriter)
     # bj10e Canon BubbleJet BJ10e
     # * bj200 Canon BubbleJet BJ200
     # * cdeskjet H-P DeskJet 500C with 1 bit/pixel color
     # * cdjcolor H-P DeskJet 500C with 24 bit/pixel color and
     # high-quality color (Floyd-Steinberg) dithering
     # * cdjmono H-P DeskJet 500C printing black only
     # * cdj500 H-P DeskJet 500C (same as cdjcolor)
     # * cdj550 H-P DeskJet 550C
     # * declj250 alternate DEC LJ250 driver
     # + deskjet H-P DeskJet and DeskJet Plus
     # * dfaxhigh DigiBoard, Inc.'s DigiFAX software format
     # * dfaxlow DigiFAX low (normal) resolution
     # djet500 H-P DeskJet 500
     # * djet500c H-P DeskJet 500C
     # epson Epson-compatible dot matrix printers (9- or 24-pin)
     # + eps9high Epson-compatible 9-pin, interleaved lines
     # (triple resolution)
     # * epsonc Epson LQ-2550 and Fujitsu 3400/2400/1200 color printers
     # * escp2 Epson ESC/P 2 language printers, including Stylus 800
     # + ibmpro IBM 9-pin Proprinter
     # * jetp3852 IBM Jetprinter ink-jet color printer (Model #3852)
     # + laserjet H-P LaserJet
     # * la50 DEC LA50 printer
     # * la75 DEC LA75 printer
     # * lbp8 Canon LBP-8II laser printer
     # * ln03 DEC LN03 printer
     # * lj250 DEC LJ250 Companion color printer
     # + ljet2p H-P LaserJet IId/IIp/III* with TIFF compression
     # + ljet3 H-P LaserJet III* with Delta Row compression
     # + ljet4 H-P LaserJet 4 (defaults to 600 dpi)
     # + ljetplus H-P LaserJet Plus
     # * m8510 C.Itoh M8510 printer
     # * necp6 NEC P6/P6+/P60 printers at 360 x 360 DPI resolution
     # * nwp533 Sony Microsystems NWP533 laser printer [Sony only]
     # * oki182 Okidata MicroLine 182
     # paintjet H-P PaintJet color printer
     # * pj alternate PaintJet XL driver
     # * pjxl H-P PaintJet XL color printer
     # * pjxl300 H-P PaintJet XL300 color printer
     # * r4081 Ricoh 4081 laser printer
     # * sparc SPARCprinter
     # * t4693d2 Tektronix 4693d color printer, 2 bits per R/G/B component
     # * t4693d4 Tektronix 4693d color printer, 4 bits per R/G/B component
     # * t4693d8 Tektronix 4693d color printer, 8 bits per R/G/B component
     # * tek4696 Tektronix 4695/4696 inkjet plotter
     #%* trufax TruFax facsimile driver [Unix only]
     # File formats and others:
     # bit A plain "bit bucket" device
     # bmpmono Monochrome MS Windows .BMP file format
     # bmp16 4-bit (EGA/VGA) .BMP file format
     # bmp256 8-bit (256-color) .BMP file format
     # bmp16m 24-bit .BMP file format
     # gifmono Monochrome GIF file format
     # gif8 8-bit color GIF file format
     # pcxmono Monochrome PCX file format
     # pcxgray 8-bit gray scale PCX file format
     # pcx16 Older color PCX file format (EGA/VGA, 16-color)
     # pcx256 Newer color PCX file format (256-color)
     # pbm Portable Bitmap (plain format)
     # pbmraw Portable Bitmap (raw format)
     # pgm Portable Graymap (plain format)
     # pgmraw Portable Graymap (raw format)
     # ppm Portable Pixmap (plain format)
     # ppmraw Portable Pixmap (raw format)
     # * tiffg3 TIFF/F (G3 fax)

   Lines beginning with a `#' are drivers included with the gs261
source distribution.

   Drivers marked with `%' require commercial software to work

   Installations of ghostscript are available from several places:

   A full, and presumably correct, installation comes with most
distributions. Note that this binary installation may require
`', as it includes the X11 display driver.

   The "official" installation is to obtain the sources and build it


   This is probably best, as you can get the latest version (currently
2.6.1pl4 (the four patches are separate, they are available from my
mail-server as `gs261-patches')).

   A patch which uses the Linux svgalib, and hence does not require X
for previewing is available. See Also: non-X previewing.

   A minimal binary installation of ghostscript and several other
packages needed for printing the Linux documentation is available as:

   Note that this does not contain any PostScript fonts. (Nor do you
need them to print dvi (aka [La]TeX).)

   The main Ghostscript documentation is contained in the file
`use.doc', either in the source directory, or
`lib/ghostscript/doc/use.doc' if you haven't the sources.

   To print ps, first determine your driver name with `gs -help' which
lists installed drivers. If the device you need is not listed, you
must compile gs yourself from the source distribution (do not panic.
Do follow the instructions in make.doc. You will need 5 or 6 megs of
space to build it in.) Then type `gs -dNOPAUSE -sDEVICE=??????
-sOutputFile=/dev/????' and your output should (hopefully)
appear at your printer. Those of you with non-US paper sizes may wish
to build gs yourself with the right default, or you may use the
`-sPAPERSIZE=a4' option.

   Ghostscript may be used to print at most of the resolutions your
printer supports; `-r300', `-r150', `-r360x180' are examples of the
option used to control this. Dot matrix printers in particular need to
choose an appropriate resolution, since they do not typically run at
the more standard 300dpi. Note that versions 2.6 and greater of
ghostscript have more drivers.

2.4 fonts

   (This section contains font information not specific to any
ghostscript driver, nor even specific to ghostscript). Font
information pertaining to the X11 `gs' drivers (and thus to ghostview)
is included in the ghostview section under previewing)

   All versions of ghostscript come with assorted public-domain fonts,
most of which were generated from bitmaps, and are therefore of
relatively poor quality. However, ghostscript can use any PostScript
Type 1 or 3 fonts you may have handy. For example, the Adobe Type
Manager (for any platform other than mac) comes with fonts you can use.
Place the fonts (typically *.pc?) in `lib/ghostscript/fonts/' and add
to `lib/ghostscript/Fontmap' lines such as:

     /Courier (com_____.pfb) ;

   A full fontmap file for the ususal set of fonts included with the
Adobe Type Manager is available as `fontmap.atm' from the printing

   TimesNewRomanPS and ArialMT fonts are interchangable with Times Roman
and Helvetica, so you can alias them this way if this is what you have.

   Adobe Type 1 fonts may be found on the net in several places:

   I have not looked in these places, but this information is lifted
straight from the comp.fonts FAQ (which you should read if fonts are a
thing for you. You can get a copy of this from `').

   Conversion between various font types is tricky. Ghostscript comes
with the tools needed to take a bitmap (hopefully large) and make a
scalable ps font. Groff comes with the tools to allow use of tfm/mf
(TeX) and pfb (Type 1) fonts in *roff documents. X11R5 includes
several font utilities and Type 1 rendering code contributed by IBM. I
have used none of the above, but they all come with manpages, so read
them. Other font conversion utilities are listed in the comp.fonts
FAQ. Also look into the package fontutils on

2.5 faxing

   If you have a fax modem, you can arrage to fax things out (and in),
including PostScript, dvi, ascii, etc... Arranging for e-mail to fax
itself somewhere is also straightforward.

   Fax modems support one of of two cammand sets: Class 1 or 2. Class
one modems are have less of what goes on in a fax supported in firmware
(thus the software has to do more. Supporting such timing-critical
things under a preemptive multitasking environment like Linux is tricky
at best). The class 1 standard is EIA 578. Class 2 modems tend to be
more expensive and comply with the standard EIA 592. Mention of your
fax modem's level of support should be in its manuals. Do not confuse
class and group. You will, of course, want a group III fax modem.

   Fax software which runs under Linux must convert input in whatever
format into a Group III compatible image format for transmission. As
usual, Ghostscript does the job. The device tiffg3 generates standard
g3/tiff encoded fax messages. You must compile this device in if it is
not there already; this is yet another reason to get the source. Some
fax sofware on commercial platforms can use the display PostScript
renderer to render the fax image; this is not yet an option under Linux.

   The GNU program netfax supports Class 2 fax modems only. It builds
nearly out of the box under linux. I have patches for version 3.2.1;
you can get them from the printing mail server as `netfaxpatch'. It
runs a server and accepts jobs into a queue from the local machine and
the net. Netfax is in use at MIT. It accepts PostScript, dvi, and
ascii, and can be configured to work as an email gate. Documentation
in the package is limited to compile notes and man pages for the
individual programs; actual installation tips are few and far between.

   FlexFax is available from:

   It is written in C++, and thus requires g++ to build. FlexFax
supports class 1 and 2 modems, uses ghostview (or a display PostScript
server) for rendering, and generally is more complete, or at least
general than the somewhat MIT-specific netfax. It also can run in
place of getty and either receive a fax or spawn a login as appropriate
for the type of call. It includes precise instructions on configuring
smail3, sendmail, and other mail agents to send mail for
so-and-so@12345678.fax to the fax at 12345678. This is the package I
recommend if you have real faxing needs, as it is properly documented
and full-featured. Version 2.x of FlexFax is in real release now and
fully supports Linux - just type `./configure' and `make'.

   mgetty+sendfax is a Linux and SCO-specific getty for faxmodems and a
simple sendfax program. This package is available as
This is a good package for those who need to send a fax every now and

   Finally, `efax' deserves mention. Class 2 only. no net, no mail,
just send a tiff. Efax is available as:

2.6 *roff, man pages

   Man pages can sometimes be printed straight from the cat pages (in
lieu of the normal nroff source pages) as though they were a normal
text file (which they mostly are). However, many printers do not like
the control characters for highlighting and what not that is imbedded
in these. A filter for this purpose comes with the net-2 lpd package.

   If you have the nroff source to the page (the finding of which I
highly recommend) you can say `man -t foobar | lpr' and your man
program will (hopefully) format the man page using groff into
PostScript, which will then be sent to your lpd and on to the printer.
This form of man page output looks MUCH better than the plain ASCII
version. Unfortunately, this depends very much on which man program
and what supporting software you have installed. If your man doesn't
do this, you might try the perl version of man, available near:

   It is written entirely in perl, and is thus easily customizable (perl
being an interpreted language reminiscent of C and sh).

   You can also find the nroff source file in the man directories (most
versions of man have an option to just spit out the filename) and do it
yourself, into any format supported by groff.
     groff -mandoc -TTYPE foobar.1 | lpr

   Where TYPE is one of `ascii', `dvi', `ps', `X100', `X75', `latin8'.

2.7 Printing text via PostScript

   There are a number of utilities to allow text to be printed to a
PostScript device.

2.7.1 mpage

   The package mpage converts plain text into PostScript and/or prints
more than one page onto each peice of paper given PostScript or text.
It is available at (or at least near):

   Note that wuarchive uses the `-z' suffix to mean `.Z', ie,
`compress', not `gzip' or `freeze'. `man -t foobar | mpage' will send a
2-up (depending on the environment variable MPAGE) version of the man
page to lpr and its PostScript interpreter. This saves paper and
speeds up printing.

2.7.2 a2ps

   A2ps will take ASCII and turn it into a nice PostScript document with
headers and footers and page numbers, printed two pages on one (or
otherwise, if you say so). A2ps does a very nice job at this. It is
available at the same place mpage is. Not that if you have a deskjet,
many n-up programs will run into trouble by trying to print in that last

2.7.3 enscript

   Enscript is a program which does basically the same thing as a2ps. I
do not know where to get it. It comes with most commercial Un*ces.

   A clone version of enscript is called nenscript, available on
`' as:

2.7.4 gslp

   Gslp is one of the uilities which comes with ghostscript 2.6.x and
purports to do the same ascii => ps conversion as enscript and a2ps. I
have not used it, but the docs say that

     gs -q -sDEVICE=????? -dNOPAUSE -- TEXT.FILE [OPTIONS]

   should do the trick. (`' is the actual program, which is
written in PostScript. Here it is run with the argument TEXT.FILE.
PostScript is in many respects a programming language more than a mere
printer command language.) Further documentation is in the file
`'. There is a script file which does the above for you.

2.8 PostScript utilities

   Those of you who deal with large amounts of PostScript may wish for
more utility programs. There are probably millions of little programs
which do things to your PostScript. A representative package of them
may be found in:

   These handle page selection, double-sided printing, booklet creation,
etc. Most large ftp sites (eg, `', `ftp.uu.uunet')
will have many such packages to choose from.

2.9 TeX/dvi

   [La]TeX is the text formatting package used by many in the academic
world and elsewhere. TeX works much like any other compiler - source
code is run through the program `tex' to become a `.dvi' file
(analogous to an .o object file in C) which can be further manipulated
to produce printed output (a "binary"). This manipulation of a dvi
(DeVice Independant) file usually takes a little bit of doing. It is
well worth it; TeX's output is of professional quality.

   If all you are given is a file with a `.tex' ending, try either `tex
file.tex' or `latex file.tex'. One of these is bound to work. Then
you have a dvi. (You may have to run it twice for indexing)

   For those in the real world who cannot afford a dvi understanding
printer, it is usually necessary to convert the dvi something the
printer understands. These programs may be run manualy but are often
built into lpd filters. See Also: Writing lpd filters.

2.9.1 `dvips'

   `dvips' converts dvi into PostScript that you can pipe into
ghostscript or send to a PostScript printer. Most installations come
with functioning installations of both TeX and `dvips'. Typing `dvips
-f1 file.dvi | lpr' will do it. `dvips' responds to either command line
arguments or a file `/usr/TeX/lib/tex/ps/' (in the usual TeX
layout, at least) in which you can arrange to have dvips automatically
send its output to `lpr'. Thus `dvips file.dvi' will do everything
that needs to be done.

   Note that some `.dvi''s may include PostScript graphics in the
`dvips' stage rather than the TeX stage of the game; if they are not
found, you will get a hole instead of a picture. This follows
naturally from the object file analogy above. Usually, pre-made
documentation in this form has a makefile or script to do everything for
you. The LILO documentation is an example of this.

   `dvips' has several interesting options; for example, `dvips -r1
file.dvi' will print it out backwards. We deskjet users love this one.

2.9.2 `eps'

   Eps is a program which converts dvi files directly into the standard
Epson printer language; thus it is a dvi driver for epsons. I beleive
it supports MakeTeXPK, the automatic font rendering system used by many
dvi drivers, and is available as:

   Note that it is still coming out with new versions fairly often, so
there may be a newer version than 061.

2.9.3 `dvilj'

   For LaserJet owners, there is a separate program that will take dvi
and convert it directly into your printer's language (PCL). It is
called dvilj2p or dvilj, and if not on tsx or sunsite, is certainly
available on

   (Description by Nils Rennebarth)

     Its a nice driver, but a little out of fashion in the sense that
     configuration (especially of font-paths) font-paths is not very
     flexible and that it doesn't support virtual fonts (at least the
     version 0.51 not). The biggest advantage over the
     dvips/ghostscript combo is that it uses downloadable fonts which:
        * reduces data transmission to the printer drastically, which
          makes the printer usable even on a serial line.

        * reduces printer-memory-requirements drastically. A standard
          Laserjet with 512k memory is able to print almost every

     It has support for double side printing and most options you
     expect a driver to have. It compiles cleanly and worked flawlessly
     on our diverse hardware here.

2.10 texinfo

   This is the native documentation format of the GNU project. Emacs
can be coerced into producing an info file from TeXinfo, and TeX can
produce nice printed documantation from the same file. It is a bit of
a stretch for both systems, but it works. It is really just TeX source
which expects the macro file `texinfo.tex' to be installed on your
system. Just do `tex FILENAME' twice (for index generation purposes),
and you end up with a plain dvi file, to print or preview at your

   In Emacs, you can also do `M-x texinfo-format-buffer' to convert the
texinfo file into an info file viewable with Emacs `M-x info' or an info
viewer of your choice.

   There are also separate programs which read and format info from a
texinfo file. These are available in:

2.11 Printing though a terminal

   Many terminals and terminal emulators support the connection of a
printer. The computer the terminal is conected to may then use a
standard set of escape sequences to operate this printer. DEC VT's and
most other ANSI terminals should offer this capability.

   A simple shell script will enable you to print a text file using the
printer connected to your terminal:

     #!/bin/csh -f
     # Transparent printing on a vt100-compatible terminal.
     echo -n \[5i ; cat $* ; echo -n \[4i

   If this script is called `vtprint', then `vtprint [FILENAME
[FILENAME]]' will print file(s) (or stdin if no file were specified) on
your printer.

2.12 hardware and drivers

   There are two ways the kernel driver may be used to run the parallel
ports. One, the original, is the polling driver. The other is the
interrupt driver. In principle, the interrupt driver only deals with
the port when it gets an interrupt and should therefore be more
efficient. In practice, people have found that it depends on the
machine. It probably doesn't make too much difference in most

   For the polling driver, you may adjust its polling frequency with the
program tunelp without kernel twiddling. The actual driver is in the
kernel source file `lp.c'.

   To choose the interrupt driver rather than the polled, use the
program tunelp to set it. (tunelp is available on sunsite, or from the
printing mail server.) Just put the appropriate line in `/etc/rc.local'

   Seven is the usual "LPT1:" IRQ, 5 is usual for "LPT2:" for an AT
class machine. Note that if your printer is on lp0, the interrupt
driver will probably not work. The first parameter should already
contain the correct i/o base address. Many bios boot screens have this
information if you need it.

   DOS uses a polling driver so if you find that your printer works in
DOS but not in Linux then you should try the polling driver.

   `tunelp' is available from the printing mail server or:

2.13 Printer device names

   On an XT bus system `LPT1:' becomes `/dev/lp0' (major=6, minor=0),
on an AT `LPT1:' becomes `/dev/lp1' (major=6, minor=1). To be more

     Name Major Minor I/O address
      lp0 6 0 0x3bc
      lp1 6 1 0x378
      lp2 6 2 0x278

   For a serial printer use the `/dev/ttyS?' (or `/devttys?', if you
follow that scheme) device, not the `/dev/cua?' device. The
`/dev/ttyS?' devices have major 4; the `/dev/cua?' devices have major 5.


   This chapter used to the the `lpd-FAQ' then it became part of the
`Linux-FAQ' and now it is part of the Printing-HOWTO. Who knows where
it will go next?

3.1 Setting up print services

   This section was originally writen Karl Auer <>
1/11/93 and has now been included here because it was felt that the
Printing-HOWTO, being written in the style of a reference manual, was
not doing its job properly, since it did not describe in a
straightforward way what you need to do to set up print services on your
Linux machine.

   So far it has been included with little modification and may
replicate or even contradict information elsewhere in the HOWTO. The
overview it gives should nevertheless be very useful to those new to
bsd print spooling.

3.1.1 Remote Printing Vs. Local Printing

   Remote printing is allowing people to send print jobs to your
computer from another computer. This will be needed if, for example,
you are running as a server in a network, or if a printer attached to
your machine is to be accessible from other Unix hosts.

   Local printing is allowing users on your machine to send print jobs
to a printer attached to your machine.

   There is a third combination too - your own use of remote printing
on other Unix machines. That is, where you wish to print on a printer
that is not attached to your own computer.

3.1.2 What You Need

   This document assumes you know how to edit a text file under Linux,
and that you have a basic understanding of file ownership and

   It also assumes that you have your Linux system set up and running
correctly. In particular, if you are going to use remote printing your
networking subsystems must be installed and operating correctly.

   Check out the man pages on the commands `chmod' and `chown' for more

3.1.3 How Printing Works Under Linux

   The simplest way to print under Unix (and thus under Linux) is to
send the print data directly to the printer device. This command will
send a directory listing to the first parallel printer (LPT1: in DOS

     ls > /dev/lp0

   This method does not take advantage of the multitasking capabilities
of Linux, because the time taken for this command to finish will be
however long it takes the printer to actually physically print the
data. On a slow printer, or a printer which is deselected or
disconnected, this could be a long time.

   A better method is to spool the data. That is, to collect the print
data into a file, then start up a background process to send the data
to the printer.

   This is essentially how Linux works. For each printer, a spool area
is defined. Data for the printer is collected in the spool area, one
file per print job. A background process (called the printer daemon)
constantly scans the spool areas for new files to print. When one
appears, the data is sent to the appropriate printer or *despooled*.
When more than one file is waiting to be printed, they will be printed
in the order they were completed - first in, first out. Thus the spool
area is effectively a queue, and the waiting jobs are often referred to
as being "in the print queue", or "queued".

   In the case of remote printing, the data is first spooled locally as
for any other print job, but the background process is told to send the
data to a particular printer on a particular remote machine.

   The necessary information that the printer daemon needs to do its
job - the physical device to use, the spool area to look in, the remote
machine and printer for remote printing and so on - is all stored in a
file called `/etc/printcap'. The details of this file are discussed

   In the discussions that follow, the term "printer" will be used to
mean a printer as specified in `/etc/printcap'. The term "physical
printer" will be used to mean the thing that actually puts characters on
paper. It is possible to have multiple entries in `/etc/printcap' which
all describe one physical printer, but do so in different ways. If this
is not clear to you, read the section on `/etc/printcap'.

3.1.4 The important programs

   There are five programs which comprise the Unix print system. They
should be in the locations shown, should all be owned by root and
belong to the group daemon and have the permissions shown here:

             -rwsr-sr-x /usr/bin/lpr
             -rwsr-sr-x /usr/bin/lpq
             -rwsr-sr-x /usr/bin/lpc
             -rwsr-sr-x /usr/bin/lprm
             -rwxr-s--- /etc/lpd

   The first four are used to submit, cancel and inspect print jobs.
`/etc/lpd' is the printer daemon.

   (The locations, ownerships and permissions given here are a
simplification and may be wrong for your system *note lpd files and

   There are man pages for all these commands, which you should consult
for more information. The important points are that by default `lpr',
`lprm', `lpc' and `lpq' will operate on a printer called `lp'. If you
define an environment variable called `PRINTER', the name thus defined
will be used instead. Both these may be overridden by specifying the
printer name to use on the command line thus:

     lpc -PMYPRINTER

3.1.5 The `lpr' Command

   The `lpr' command submits a job to the printer, or "queues a print
job". What actually happens is that the file you specify is copied to
the spool directory (see above), where it will be found by `lpd', which
then takes care of moving the data to the physical printer. If you don't
specify a file, `lpr' uses standard input.

3.1.6 The `lpq' Command

   The `lpq' command shows you the contents of the spool directory for
a given printer. One important piece of information displayed by `lpq'
is the job id, which identifies a particular job. This number must be
specified if you wish to cancel a pending job.

   `lpq' also shows a rank for each job in the queue - "active" means
the file is actually printing (or at least that `lpd' is trying to
print it). Otherwise a number shows you where in the queue the job is.

3.1.7 The `lprm' Command

   The `lprm' command removes a job from the queue - that is, it
removes unprinted files from the spool directory. You can either specify
a job id (obtained by using the `lpq' command) or specify `-' as the
job id, in which case all jobs belonging to you will be cancelled. If
you do this as root, all jobs for the printer will be cancelled. If you
are root and want to remove all the jobs belonging to a specific user,
specify the user's name.

3.1.8 The `lpc' Command

   The `lpc' command lets you check the status of printers and control
some aspects of their use. In particular it lets you start and stop
despooling on printers, lets you enable or disable printers and lets you
rearrange the order of jobs in a print queue. The following commands
disable printing on myprinter, enable the spool queue on yourprinter and
move job number 37 to the top of the queue:

     lpc down myprinter
     lpc enable yourprinter
     lpc topq 37

   If invoked without any command arguments, lpc will be interactive,
prompting you for actions to take. Read the man page for complete
instructions. Bear in mind that some `lpc' functions are restricted to

3.1.9 The Important Directories

   There is really only one important directory - the spool area where
data to be printed is accumulated before `/etc/lpd' prints it. However,
typically a system will be set up with multiple spool directories, one
for each printer. This makes printer management easier. My system is set
up to use `/usr/spool/lpd' as the main spool area, with each separate
printer having a directory under that with the same name as the
printer. Thus I have a printer called `ps_nff' which has
`/usr/spool/lpd/ps_nff' as its spool directory and so on.

   The spool directories should belong to the daemon group and be user
and group read/writable, and world -readable. That is, after creating
the directory make sure it has permissions "-rwxrwxr-x" (0775). For the
directory myprinter, the appropriate command would be:

     chmod ug=rwx,o=rx myprinter
     chgrp daemon myprinter

   (The locations, ownerships and permissions given here are a
simplification and may be wrong for your system *note lpd files and

3.1.10 The Important Files

   Apart from the programs discussed above, each spool directory should
contain four files - `.seq', `errs'. `lock' and `status'. These files
should have the permissions "-rw-rw-r-". The `.seq' file contains the
job number counter for `lpr' to assign a and the `status' file contains
the message to be reported by `lpc stat'. The `lock' file is used by
`lpd' to prevent itself trying to print two jobs to the same printer at
once, and the `errs' file is a log of printer failures.

   The file `errs' is not required and can actually be called whatever
you like - the name is specified in `/etc/printcap', but the file must
exist for `lpd' to be able to log to it, so it is usually created
manually when setting up the spool area. More on this later.

   One very important file is the file `/etc/printcap', which is
described in detail in the following sections.

3.1.11 More About /etc/printcap

   The file `/etc/printcap' is a text file, which may be edited with
your favourite editor. It should be owned by root and have the
permissions "-rw-r-r-".

   The contents of `/etc/printcap' are typically very cryptic-looking,
but once you know how it works they are much easier to understand. The
problem is compounded by the fact that in some braindead distributions
there is no man page for printcap, and the fact that most printcaps are
created either by programs or by people with no thought for
readability. For your own sanity, I recommend making the layout of your
printcap file as logical and readable as possible, with lots of
comments. And get the a man page from the lpd sources, if you don't
already have it.

   One printcap entry describes one printer. Essentially a printcap
entry provides a logical name for a physical device, then describes how
data to be sent to that device is to be handled. For example, a printcap
entry will define what physical device is to be used, what spool
directory data for that device should be stored in, what preprocessing
should be performed on the data, where errors on the physical device
should be logged and so forth. You can limit the amount of data which
may be sent in a single job, or limit access to a printer to certain
classes of user.

   It is perfectly OK to have multiple printcap entries defining several
different ways to handle data destined for the same physical printer.
For example, a physical printer may support both PostScript and HP
Laserjet data formats, depending on some setup sequence being sent to
the physical printer before each job. It would make sense to define two
printers, one of which preprocesses the data by prepending the HP
LaserJet sequence while the other prepends the PostScript sequence.
Programs which generate HP data would send it to the HP printer, while
programs generating PostScript would print to the PostScript printer.

   Programs which change the data before it is sent to the physical
printer are called "filters". It is possible for a filter to send no
data at all to a physical printer.

   See Also: The Syntax of /etc/printcap

     # Sample printcap entry with two aliases
             # lp is the device to print to - here the first parallel printer.
             :lp=/dev/lp0: \
             # sd means 'spool directory' - where print data is collected

3.1.12 Fields in `/etc/printcap'

   There are too many fields to describe here in full, so I'll just
describe the most important ones. All fields in `/etc/printcap' (except
for the names of the printer) are enclosed between a pair of colons and
are denoted by a two-letter code. The two-letter code is followed by a
value that depends on the type of field. There are three types of field
- string, boolean and numeric See Also: The Syntax of /etc/printcap.

   The following fields are the most common and most important ones:

     lp string specify the device to print to, eg /dev/lp0
     sd string specify the name of the spool directory for
                             this printer
     lf string specify the file to which errors on this
                             printer are to be logged
     if string specify the input filter name
     rm string specify the name of a remote printing host
     rp string specify the name of a remote printer
     sh boolean specify this to suppress headers (banner pages)
     sf boolean specify this to suppress end-of-job form feeds
     mx numeric specify the maximum allowable print job size
                             (in blocks)

3.1.13 More on The `lp' Field

   If you specify `/dev/null' as the print device, all other processing
will be performed correctly, but the final data will go to the bit
bucket. This is rarely useful except for test printer configurations or
with weird printers See Also: Printers not in /dev. When you are setting
up a remote printer (that is, you have specified `rm' and `rp' fields),
you should specify `:lp=:'.

   Don't leave the field empty unless you are using a remote printer.
The printer daemon will complain if you don't specify a print device.

3.1.14 More On The lf Field

   Whatever file you specify should already exist, or logging will not

3.1.15 More On The if Field

   Input filters are programs which take print data on their standard
input and generate output on their standard output. A typical use of an
input filter is to detect plain text and convert it into PostScript.
That is, raw text is its input, PostScript is its output. See Also: Writing
lpd filters.

   When you specify an input filter, the printer daemon does *not* send
the spooled print data to the specified device. Instead, it runs the
input filter with the spooled data as standard input and the print
device as standard output. (For another use for input filters *note A
test printcap entry.).

3.1.16 More On The `rm' and `rp' Fields

   Sending your print data to a printer attached to another machine is
as simple as specifying the remote machine `rm' and the remote printer
`rp', and making sure that the print device field `lp' is empty. Note
that data will still be spooled locally before being transferred to the
remote machine, and any input filters you specify will be run also.

3.1.17 More On The `sh' and `sf' Fields

   Unless you have a lot of different people using your printer, you
will most likely not be interested in banner pages.

   Suppressing form feeds is most useful if your printer is typically
used for output from wordprocessing packages. Most WP packages create
complete pages of data, so if the printer daemon is adding a form feed
to the end of each job, you will get a blank page after each job. If the
printer is usually used for program or directory listings, however,
having that form feed ensures that the final page is completely ejected,
so each listing starts at the top of a new page.

This is Info file, produced by Makeinfo-1.55 from
the input file printing.texinfo.

   A guide to printing and previewing files under the Linux operating

   Copyright (C) 1994 by Grant Taylor and Brian McCauley

3.1.18 More On The `mx' Field

   This field allows you to limit the size of the print data to be
spooled. The number you specify is in BUFSIZE blocks (1K under Linux).
If you specify zero, the limit is removed, allowing print jobs to be
limited only by available disk space. Note that the limit is on the
size of the spooled data, *not* the amount of data sent to the physical
printer. If a user tries to exceed this limit the file is tuncated. The
user will see a message saying "lpr: <filename>: copy file is too

   For text physical printers, this is useful if you have users or
programs that may deliberately or accidentally create excessively large
output, but in most cases is not really very applicable.

   For PostScript physical printers, the limit is not useful at all,
because a very small amount of spooled PostScript data can generate a
large number of output pages.

3.1.19 A Test Printcap Entry

   The following shell script is a very simple input filter - it simply
concatenates its input onto the end of a file in `/tmp' after an
appropriate banner. We specify this filter in our printcap entry and
specify `/dev/null' as the print device. The print device will never
actually be used, but we have to set it to something because otherwise
the printer daemon will complain.

     # This file should be placed in the printer's spool directory and
     # named input_filter. It should be owned by root, group daemon, and be
     # world executable (-rwxr-xr-x).
     echo ------------------------------------------------ >> /tmp/testlp.out
     date >> /tmp/testlp.out
     echo ------------------------------------------------ >> /tmp/testlp.out
     cat >> /tmp/testlp.out

   Here's the printcap entry. Notice the (reasonably) readable format
and the use of continuation characters on all but the last line:

     myprinter|myprinter: \
             :lp=/dev/null: \
             :sd=/usr/spool/lpd/myprinter: \
             :lf=/usr/spool/lpd/myprinter/errs: \
             :if=/usr/spool/lpd/myprinter/input_filter: \
             :mx#0: \
             :sh: \

3.1.20 Putting It All Together

   Putting all the above bits together, here is a step by step guide to
setting up a single printer on `/dev/lp0'. You can then extend this to
other printers. You have to be root do do all this, by the way.

  1. Check the permissions and locations of `lpr', `lprm', `lpc', `lpq'
     and `lpd' See Also: The important programs.

  2. Create the spool directory for your printer, which we will call
     `myprinter' for now. Make sure both are owned by root, group
     daemon, and are user and group writeable, readonly for others

          mkdir /usr/spool/lpd /usr/spool/lpd/myprinter
          chown root.daemon /usr/spool/lpd /usr/spool/lpd/myprinter
          chmod ug=rwx,o=rx /usr/spool/lpd /usr/spool/lpd/myprinter

  3. In the directory `/usr/spool/lpd/myprinter', create the necessary
     files and give them the correct permissions and owner:

          cd /usr/spool/lpd/myprinter
          touch .seq errs status lock
          chown root.daemon .seq errs status lock
          chmod ug=rw,o=r .seq errs status lock

  4. Create the shell script input_filter in the directory
     `/usr/spool/lpd/myprinter'. Use the input filter given above. Make
     sure that the file is owned by root, group daemon, and is
     executable by anyone.

          cd /usr/spool/lpd/myprinter
          chmod ug=rwx,o=rx input_filter

  5. Create the file `/etc/printcap' if it doesn't already exist. Remove
     all entries in it and add the test printcap entry given above.
     Make sure the file is owned by root, and readonly to everyone else

  6. Edit the file `rc.local'. Add the line `/etc/lpd' to the end. This
     will run the printer daemon each time the system boots. It is not
     necessary to boot now though - just run it by hand:

  7. Do a test print:
          ls -l | lpr -Pmyprinter

  8. Look in `/tmp' for a file called `testlp.out' - it should contain
     your directory listing.

  9. Edit `/etc/printcap'. Copy the myprinter entry, so you have two
     identical entries.

        * in the *first* entry, change both occurrences of `myprinter'
          to `testlp' in the first line only

        * in the *second* entry, change `/dev/null' to your real print
          device, eg., `/dev/lp0'

        * in the *second* entry, remove the `if' line completely

 10. Either reboot the system or kill the printer daemon and restart it.
     This is because the printer daemon only looks at the /etc/printcap
     file when it first starts up.

 11. Do a test print again - this one should come out on your physical
          ls -l | lpr -Pmyprinter

3.1.21 More On Remote Printing

   In order for any other machines to print using your printers, their
names will have to be registered in either the file `/etc/hosts.equiv'
or `/etc/hosts.lpd'. These are simple text files, one host name per

   For preference, add hosts to `/etc/hosts.lpd'. `/etc/hosts.equiv' is
used to give far wider access rights, and should be avoided wherever

   You can restrict remote users either by group name (specify the
groups permitted using one or more rg fields in `/etc/printcap' -
`:rg=admin:' will restrict access to a printer to those users belonging
to the group admin. You can also restrict access to those users with
accounts on your system, by specifying the boolean flag `:rs:' in your

3.1.22 The Fiddly Bits

   If all the above worked, you will now have two printers defined in
`/etc/printcap' - one called testlp, which appends output to
`/tmp/testlp.out', and one called myprinter which sends unmodified
output to the physical printer attached to `/dev/lp0'. Both share the
same spool directory. As an exercise, you might like to set up a
separate spool directory for the testlp printer.

   If your printer is a PostScript printer, it may not be able to handle
plain text. If this is the case, you'll need to set up a filter to
convert plain text to PostScript. An excellent freeware program called
nenscript is available which does just this. See Also: PostScript. If you
don't set up such a filter, you will have to make sure by other means
that the printer is sent only PostScript.

   You may like to add a line to your login script - or even to the
default user login script - which sets up a `PRINTER' environment
variable. Under bash, a suitable line would be `export
PRINTER=myprinter'. This will prevent people having to specify
`-Pmyprinter' every time they submit a print job.

   To add more printers, just repeat the above process with different
printer names. Remember you can have multiple printcap entries all using
the same physical device. This lets you treat the same device
differently, depending on what you call it when you submit a print job
to it.

   It is possible to "reuse" a printcap entry. If you specify your own
machine as the remote host and another printer in your printcap file as
the remote printer, you can effectively redirect print data from one
printer to another. Remember if you use this technique that all the
data will be processed by all input filters in the chain and spooled for
each printer it goes through.

   Although you can specify as many aliases for a printer as you like,
it seems that for maximum usefulness the first two should be the same
and should be the "real" printer name. Many programs will only ever use
one of these two aliases. The `lpc' command will only report on the
first alias, though `lpc', `lpr', `lprm' and `lpq' all understand any

   Rather than specify a maximum spool file size, you may want instead
to prevent spool files expanding to fill your disk, even temporarily.
To do so, put a file called minfree in each spool directory, specifying
the amount of disk space that must remain for spooling data to be
accepted. This file is a simple text file, containing the number of
blocks to be left free. Usually this file is a link to a file in the
main spool directory, as it is rare for different printers to have
different minimums.

3.1.23 Troubleshooting

   Problem: You get a message saying "lpd: connect: No such file or

   Answer: The printer daemon `/etc/lpd' is not running. You may have
forgotten to add it to your `/etc/rc.local' file. Alternatively you did
add it, but haven't booted since. Add it and reboot, OR just run
/etc/lpd. Remember you have to be root to do this. See Also: lpd not

   Problem: You get a message saying "Job queued, but cannot start

   Answer: This often appears right after the "lpd: connect" message.
Same problem.

   Problem: You get a message saying "lpd: cannot create

   Answer: You have not created the spool directory specified in the
printcap entry or have misnamed it. An alternative (though much less
likely) answer is that you have too little disk space left.

   Problem: You get a message saying "lpr: Printer queue is disabled".

   Answer: As root, use `lpc enable <PRINTERNAME>' to enable the
printer. Note that as root, you can submit jobs even to a disabled

   Problem: You submit a print job, there are no error messages, but
nothing comes out on the physical printer.

   Answer: There could be many reasons. Make sure the physical printer
is switched on, selected, and physically connected to the device
specified in the `/etc/printcap' file. Use the `lpq' command to see
whether the entry is in the queue. If it is, then the device may be
busy, the printer may be down, or there may be an error on the printer.
Check the error log specified in the printcap entry for clues. You can
use the `lpc status' command to check whether the printer is down and
`lpc up <PRINTERNAME>' to bring it back up if it is (you need to be
root to do this).

   If after checking as suggested your print jobs still do not come out,
double check that any input filter you have specified is present in the
correct directory and has the correct permissions. If you are running
syslogd, you can look in your logs for messages from lpd. If you see log
entries saying "cannot execv <name of input filter>", then this is
almost certainly the problem.

   Another possibility is that your printer is a PostScript printer and
you are not sending PostScript to it. Most PostScript printers will
ignore non-PostScript data. You may need to install an appropriate
text-to-PostScript input filter.

   Lastly (and you'll feel really silly if this is the cause!) check
that your input filter actually generates output and that the output
device is not `/dev/null'.

   Problem: When remote printing, your jobs go into the remote queue
but never get physically printed.

   Answer: If you can, look at the entry for the remote printer in the
`/etc/printcap' file on the remote machine. It may be restricting your
access. The `rg' field restricts access to members of a specific group
which you may not be in, and the `rs' field prevents access from users
without accounts on the remote machine, which you may not have.
Alternatively the printer on the remote machine may have been downed by
the system administrator. See Also: lpr over a network.

3.2 What lpr and lpd do

   Most Un*x systems use `lpd' (or the System V variant `lp'), the line
printer daemon, and friends to spool print jobs and run them through
all needed filters. While line printers are certainly on their way
out, spooling print jobs and running them through filters is definitely
a convenient thing. Thus lpr. (subliminal note: *PLEASE* find and
read the `lpr', `lpd', `printcap', `lpc', `lpq', and `lprm' man pages.
They are in the source dist of the net-2, if you haven't got them.)

3.3 Getting hold of lpd

   Lpd and family are available in several places. The new Linux net-2
package contains a working BSD-style lpd (although it has a couple of
bugs and Makefile installs the binaries with the wrong permissions). I
now use this one with my stock 0.99pl14 kernel after following the
directions in Matt Welsh's Net-2 HOWTO to get my NET-2 going (you only
need loopback). Most people (and this document) consider this to be
*the* Linux lpd package. A slightly debugged version incorporating
patches from earlier releases of this HOWTO is also available in:

   Some of the prepackaged Linux distributions have a very poor record
with respect to having a working lpd packages so don't be shy of
getting a new one if you seem to be having trouble.

   Fans of the SysV lp package should consider getting plp (however this
HOWTO contains no information on that package)

   An lpd binary package which can be coaxed into working with the old
net things (pre 0.99pl10 kernel) may still be around but you'll probably
find it a bit shakey and you really should update your kernel. Note a
subtle difference between the two versions: the old one placed lock
files and such in `/var/spool', while the net-2 version requires the
directory `/var/spool/lpd' to exist for its lock file.

   You will need to edit `/etc/printcap' to configure lpd to use your
printer. Setting up lpd to accept PostScript and print it is not very
difficult; simply make a shell script filter. See Also: Writing lpd

   Setting up lpd correctly is definitely worth the trouble if you are
going to do any printing at all. Of course, if all you ever print is
the occasional man page or instruction book, then you can probably get
by without it (but even then it's nice).

   Ghostscript 2.6.x also comes with a complicated script and utilities
to generate printcap entries and manage multiple types of queues for a
printer. I have not tested these, but I assume they can be made to
work. If you are in a large-scale environment with varied printing
needs, these may be worth a look.

3.4 Where Do The Files Go And What Should Their Permissions Be?

   There is quite a bit of variation between the various releases but
I'll try where possible to offer solutions that are universally
applicable. Start `lpd' in your `/etc/rc' or `/etc/rc.local' (usually
in `/etc/rc.local' after you start `syslogd' (if you use `syslogd')).

   Set the group fields of the file permissons/ownership as follows:

     -rwxr-sr-- 1 root lp 37892 Nov 19 23:32 /etc/lpd
     -rwxr-sr-x 1 root lp 21508 Nov 19 23:32 /usr/bin/lpc
     -rwsr-sr-x 1 root lp 17412 Nov 19 23:32 /usr/bin/lpq
     -rwxr-sr-x 1 root lp 17412 Nov 19 23:32 /usr/bin/lpr
     -rwxr-sr-x 1 root lp 17412 Nov 19 23:32 /usr/bin/lprm
     -rwxr-xr-x 1 root lp 2816 May 10 13:37 /usr/bin/lptest
     ...and for each of the spool directories listed in the sd fields of
     total 5
     drwxrwxr-x 2 root lp 1024 May 18 23:00 .
     drwxr-xr-x 11 root root 1024 Feb 19 20:56 ..
     -rw-rw-r-- 1 root lp 4 May 18 23:00 .seq
     -rw-rw-r-- 1 root lp 18 May 18 23:00 lock
     -rw-rw-r-- 1 root lp 25 May 18 23:00 status

   Note these 3 files are created by lpr and lpd so if you've never run
these they will be absent. With some versions of the lpd package you
had to touch them into being or they would be created with the wrong
permissions but this bug seems to have been fixed.

   In older versions the group id was `daemon' not `lp'. There's also a
named socket but `lpd' creates/deletes it as needed. Also you may find
the uid is sometimes set to `daemon' or `lp' rather than `root' but
this is of no consequence except on setuid binaries.

   These permissions are the most pedantic so don't be surprised if
your system works with different permissions. On the other hand if lpd
is not working for you and you have different permissions please try
these before mailing us or posting to usenet. (This may sound obvious
but you'd be amazed how much mail I've had from people with the
permissions set wrong).

   People tell me that `lpr' must be setuid(root) but I've not seen
evidence that this is really the case as long as the file permissions on
the spool queues are right. Still as far as I know `lpr' is designed to
be secure when installed setuid(root). This allows an alternative
(sloppy) approach: just make `lpr' and `lprm' setuid(root) then you can
almost forget the file permissions on the spool queues!

   You're free to choose different directories for the executables on
your system (notably `lpc' is usually in `/etc' (or `/usr/sbin') even
though it has commands that are useful to non-root). Of course since
you are free to do this it implies the person who made up your
distribution was also free to do so, so be carefull to make sure you
delete old components when you install new ones.

   The master lpd lock file is fixed at compile time to be
`/var/spool/lpd/lpd.lock' so you must have a `/var/spool/lpd directory'
even if you choose not to keep your spool queue there. In the older
binaries the lock file was `/usr/spool/lpd.lock' so this was not an

   My advise is to keep your primary spool queue in `/usr/spool/lpd' and
make `/var' a symlink to `usr' or keep it in `/var/spool/lpd' and make
`/usr/spool' a symlink to `../var/spool'. This gives the greatest
compatibility with the pathnames that are compiled into the various
distributed binaries. Note that having a separate `/var' filesystem
avoids the problem of your `/usr' filesystem filling up as a result of
stuff in spool queues.

   The main configuration file is `/etc/printcap'. Network printing also
uses `/etc/hosts.allow' and `/etc/hosts.lpd'.

   By now everyone should have libraries and binaries that look for
config files in `/etc'. If you chose to keep your configs somewhere else
(`/conf' or `/usr/etc' for example) then `/etc' must contain a symlink
to the real file. If you still have a system which looks for files in
`/usr/etc' or `/etc/inet' your system is way out of date and you should

3.5 lpd not working

   If `ps ax' does not reveal a `lpd' then you daemon has died (or was
never started) - usually a sign that it couldn't create its lockfile,
or was unable to find `/etc/services'. (This will happen if you tried
to start it before all your filesystems were mounted).

   If `lpr' works only for root then you've probably got a permission

   If you cant even `cat' files to the printer then you may be using
the wrong device name for the printer in `/etc/printcap' See Also: Printer
device names or you may need to fiddle with `tunelp'. See Also: hardware
and drivers.

   If you get "jobs queued, but cannot start daemon" or "lpc: connect:
No such file or directory" while `lpd' is running then you are having
trouble with the socket connection to `lpd'. "start" in the context of
this error really means "wake". This problem has come and gone
thoughout the history of Linux - I don't really understand this but it
stems from an erroneous interaction between the networking stuff and
"Unix domain" (non-network) sockets. Usually it has only shown up when
the network is incorrectly configured. If you're not really on a
network it is usually adequate just to have the following somewhere in
your startup.

     ifconfig lo localhost
     route add localhost

   You'll also need to have the `/etc/hosts' file. There's no need to
run any daemons.

   There is second and much more understandable way to produce this
error - use a mixture of components from different releases of lpd that
use different names for the Unix domain socket (new stuff uses
`/tmp/.printer', obsolete stuff `/dev/printer'). (For some time SLS was
released this way).

   At the time of writing I am quite unable to reproduce this error - I
am using my debugged version of the net-2 lpd compiled with gcc-2.4.5
and libc-4.4.4 on kernel 0.99.14.

3.6 Where Do I Get A Printcap For Printer Model xxxxx?

   This question is essentially meaningless so please don't ask it on
usenet See Also: The Semantics of /etc/printcap.

3.7 The Semantics of `/etc/printcap'

   Given the similarity in appearance and name between `/etc/termcap'
and `/etc/printcap' one could be forgiven for assuming that they
contain analogous infomation. This is not the case. Whereas
`/etc/termcap' contains informations about terminal *types* - (mostly
escape seqences) printcap contains information about *specific*
printers (like the directory that holds the spool queue, the device
name of the printer and what room it's in). The information about a
printer model's escape sequences and so on are held in the various
"filters" which are programs called by `lpd' to drive the printer.
`/etc/printcap' simply gives the locations of these filters. For
details RTFM(printcap). [Alternatively the net-HOWTO has a summary of
some of the more important fields.]

   One last point - you should always specify `suppress header' `:sh:'
unless you have a *text* (not PostScript) printer and want banners. On
a text printer they are usually a waste of time and paper. On a
PostScript printer they usually stop your printer working. See Also:
Burst/banner pages.

3.8 The Syntax of `/etc/printcap'

   Ideally RTFM(termcap) (yes, I said *termcap*) but since most people
don't have TFM(termcap) here are the essentials.

   Lines starting with `#' are comments (as you might have guessed).

   For each printer usable from the `lpr' command on your system there
is one logical line in the file. For the sake of readability each
logical line may be spread over several physical lines by making the
last character on all but the last physical line a backslash.

   Each logical line has the following format:


   The leading spaces and colon on the second line are for readability

   A printer can have as many names as you like but conventionally the
final name is used as a longhand description of the printer. (Still
people are free to say `lpr -P "grotty teletype in room 213"' if that's
the description you've given.) One of the names of your default printer
must be `lp'.

   The list of capabilities can be as long as needed and the order is
not significant. Each "capability" is denoted by a two character code.
(The name "capability" comes form the file format's termcap heritage -
parameter or attribute would be a more sensible terms.) [Note from Ross
Biro: capabilities with 3 character names don't work properly which is
why the serial port stuff in the old binaries failed.] Capabilities
having string value and have a `=' delimiter between the capability
name and the value while those having a numeric value use a `#'
(actually they can use either a `#' or an `='). Boolean "capabilities"
are true if they appear in the list and false if they do not.

   Special characters in a string value can be expressed using
backslash-escaped sequences as in C; in addition, `\E' stands for ESC.
`^' is also a kind of escape character; `^' followed by CHAR stands for
the control-equivalent of CHAR. Thus, `^a' stands for the character
control-a, just like `\001'. `\' and `^' themselves can be represented
as `\\' and `\^' respectively. `\:' for `:' seems to work but the
source code contains a warning that it can confuse the parser and
`\072' is a better idea.

     lp|bam|Epson FX-80:lp=/dev/lp1:sd=/usr/spool/lp1:sh:mx#0:\

   The printer's name is `lp' (this is the printer that `lpr' uses by
default). It's also known as `bam' or `"Epson FX-80"'.

   The printer is on `/dev/lp1' (aka AT-bus LPT1:). I don't want a burst
page. I don't want a file length limit. Files queued by `lpr -d' are
passed through `/usr/local/lib/magic-filter/lp.df' and those queued by
`lpr' through `/usr/local/lib/magic-filter/lp.lf'.

   See also the next section.

3.9 An `/etc/printcap' gotcha

   Two `/etc/printcap' files can look identical and yet one works and
the other doesn't.

   See if `lpc stat' reports a printer called ` :'. The last character
on a continued line must be a backslash. If there are whitespace
characters after the backslash then it doesn't register the next line
as a continuation.

3.10 The Minimum /etc/printcap

   This is a silly question but it is frequently asked. The answer is
`lp:sh' (that's 6 bytes including the required linefeed character on
the end). To use this `/etc/printcap' you must make `/dev/lp' a symlink
to your printer and create your spool queue directory as
`/usr/spool/lpd'. (You might think that if you wanted banner pages you
could loose the `:sh' but the termcap syntax requires at least one
capability per entry).

3.11 How to prevent the `Staircase Effect'

   Un*x terminates each line of a file with a linefeed but not a
carriage return so taken literally a Un*x text file printed on an ASCII
device will start each line below the end of the previous line. Some
printers can be set to treat "linefeed" as "carriage return, linefeed",
others can't. If yours can then do simply do that. If the printer
cannot be fixed create a shell script filter that reads:

     if [ "$1" = -c ]; then
       sed -e s/$/^M/
     # the ``echo -ne'' assumes that /bin/sh is really bash
     echo -ne \\f

   Where `^M' is a carriage return character not a `^' followed by a
`M'. To type `^M' in Emacs use the sequence `C-q C-m' and in vi use
`C-v C-m'. Conventionally this script is called `/usr/lib/lpf'. If you
have more than one such script a better idea is to keep them in a
subdirectory, say `/usr/lib/lpd/'. The test of `$1' allows the
insertion of carriage returns to be switched off by `lpr -l'.

   Install this filter as the `if' filter by putting
`:if=/usr/lib/lpf:' (or whatever) in your `/etc/printcap' entry for the

   Alternatively your printer may have an escape sequence that will set
the way it handles linefeed characters. A simple filter that uses an
`echo -ne' command to send this sequence may be appropriate.

     # Filter for HP printers to treat LF as CRLF
     # the ``echo -ne'' assumes that /bin/sh is really bash
     echo -ne \\033\&k2G
     echo -ne \\f

3.12 Resetting the printer between each file printed

   Either make your filters do it or define the `tr' "capability" in
`/etc/printcap' to be your printer's font reset command. For details of
the format of this string see the question on the format of printcap.
This may not work if a printout crashes in the middle of an escape
sequence - putting a lot of `^@' on the front may help but this
probably won't be enough it you were printing raster graphics when the
filter died.

3.13 Preventing formfeed after each file printed

   If you don't have an `if' specified in `/etc/printcap' then `lpd'
will automatically put a formfeed at the end of each file. If you're
using a filter then it's up to the filter to decide if it wants to put
a formfeed. To disable formfeed completely if you don't have an `if'
put `:ff=:' in your `/etc/printcap'. But please note this suppresses
the formfeed that would usually be printed if a filter dies. If you
want formfeeds after text printouts but not on printouts printed with
`lpr -l' then create the following `if' filter:

     # the ``echo -ne'' assumes that /bin/sh is really bash
     if [ "$1" != -c ]; then
       echo -ne \\f

   If you want a formfeed after `lpr -l' to be optional you can misuse
the `-i' switch to suppress the formfeed with the following trick (after
all `lpr -i -l' would usually not be implemented).

     # use lpr -i -l to print raw without trailing formfeed
     if [ "$1" != -c -o "$4" = -i0 ]; then
       # the ``echo -ne'' assumes that /bin/sh is really bash
       echo -ne \\f

3.14 Printing with lpd to a serial port

   The first if lpd complains about "ioctl(TIOCEXCL)" being
unimplemented you need a version of lpd that doesn't care (eg.

   There are two sets of flags which you will need to set, plus the baud
rate (Note: the `fc' flag setting seems to override the `br#'
capability, so be sure to set that correctly as well as the `br#'!).

   Each of the flags can have bits set and cleared. Clearing is done
first, so specify the clear flags (`fc#' and `xc#') before the set
flags (`fs' and `xs').

   Setting the `br#' capability is self-explanatory. Example: `br#9600'

   It is very easy to translate from `stty' settings to printcap flag
settings. If you need to, see the man page for stty now.

   Use stty to set up the printer port so that you can cat a file to it
and have it print correctly. Here's what `stty -a' looks like for my
printer port:

     dina:/usr/users/andy/work/lpd/lpd# stty -a < /dev/ttyS2
     speed 9600 baud; rows 0; columns 0; line = 0;
     intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
     eol2 = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;
     lnext = ^V; min = 1; time = 0;
     -parenb -parodd cs8 hupcl -cstopb cread -clocal -crtscts
     -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr
     -igncr -icrnl ixon -ixoff -iuclc -ixany -imaxbel
     -opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0
     bs0 vt0 ff0
     -isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop
     -echoprt -echoctl -echoke

   The only changes between this and the way the port is initialized at
bootup are `-clocal', `-crtscts', and `ixon'. Your port may well be
different depending on how your printer does flow control.

   Once you have your stty settings right, so that `cat file >
/dev/ttyS2' (in my case) sends the file to the printer, look at the file
`/usr/src/linux/include/linux/termios.h'. This contains a lot of
`#define's and a few structs (You may wish to cat this file to the
printer (you do have that working, right?) and use it as scratch paper
- I (Andrew Tefft <> did!). Go to the section
that starts out

     /* c_cflag bit meaning */
     #define CBAUD 0000017

   This section lists the meaning of the `fc#' and `fs#' bits. You
will notice that the names there (after the baud rates) match up with
one of the lines of stty output. Didn't I say this was going to be easy?

   Note which of those settings are preceded with a - in your stty
output. Sum up all those numbers (they are octal). This represents the
bits you want to *clear*, so the result is your `fc#' capability. Of
course, remember that you will be setting bits directly after you
clear, so you can just use `fc#0177777' (I do).

   Now do the same for those settings (listed in this section) which do
not have a - before them in your stty output. In my example the
important ones are CS8 (0000060), HUPCL (0002000), and CREAD (0000200).
Also note the flags for your baud rate - mine is 0000015. Add those all
up, and in my example you get 0002275. This goes in your `fs#'
capability (`fs#02275' works fine in my example).

   Do the same with set and clear for the next section of the include
file, "c_lflag bits". In my case I didn't have to set anything, so I
just use `xc#0157777' and `xs#0'.

   Once your printcap is set up, try it out. If things don't work, see
the next section.

3.15 cat works to the serial port, but not lpd (1)

   Generally getting lpd up and running is explained elsewhere, but if
you are having trouble with serial port settings you can prevent `lpd'
from trying to configure your port by treating you printer as one that
does not present a normal device interface. See Also: Printers not in

  1. Set your printer (in your printcap) to `/dev/null1'. (`mknod
     /dev/null1 c 1 3' because you don't want `/dev/null' to be opened

     remove the baud rate and flags settings from your printcap.

  2. Create a script such as this:

          echo if: $* >> /var/spool/lpd/results
          # /dev/lp is linked to /dev/ttyS2 which has the printer
          exec your-old-input-filter $* > /dev/lp
        ...or if you didn't have an old `if' installed...
          echo if: $* >> /var/spool/lpd/results
          cat > /dev/lp
          # the ``echo -ne'' assumes that /bin/sh is realy bash
          echo -en \\f > /dev/lp

     Make sure it's world-executable and world-readable. Try out your
     script (`/usr/lib/lpd/if < SOMEFILE') and see if it prints.

  3. Set the `if' capability in your printcap to call this script, e.g.

  4. Use stty to correctly set your port settings. Try to print now.
     You should be able to tell if things are being spooled, and things
     *should* be printed, if your manual testing of the `if' script
     works. But this is a kludge, so the idea is not to use the `if'

   Assuming the above method using the `if' filter works and that you
believe that you have specified what you think are the correct flags
and baud rate in printcap; check `stty -a < /dev/ttyS2' (or whatever
your printer port is). If the settings are not correct, check your
flags against your printout from termios.h. If the settings are *way*
not correct, you may need a fixed lpd. The patch follows, and you can
probably see why it's needed :-) Note: this patch is reversed and has
already been applied (uh... unapplied :-) ) to lpd-590p2 so don't apply
it if you already have that version or later.

   (the patch is coming in just a sec)

   When I was setting mine up, I followed a sequence like this:

     lprm WHATEVER # (make sure queue is empty and lpd is running)
     stty CORRECT SETTINGS < /dev/ttyS2
     stty -a < /dev/ttyS2 # (often had to ctrl-c out of this one)
     twiddle with flags
     lprm WHATEVER # make sure queue is empty again...

   Here's the patch (I it's reversed so apply it with `-R' - or, in
practice, by hand!):

     -------------------------------Cut Here-------------------------------------
     *** lpd-590/lpd/printjob.c Thu Jul 8 20:56:59 1993
     --- lpd-590/lpd/printjob.c~ Sat Feb 27 09:07:01 1993
     *** 1271,1277 ****
       #ifdef LINUX
             ttybuf.c_cflag &= ~FC; /* not quite right! */
     ! ttybuf.c_cflag |= FS; /* not quite right! */
             ttybuf.sg_flags &= ~FC;
             ttybuf.sg_flags |= FS;
     --- 1271,1277 ----
       #ifdef LINUX
             ttybuf.c_cflag &= ~FC; /* not quite right! */
     ! ttybuf.c_cflag |= ~FS; /* not quite right! */
             ttybuf.sg_flags &= ~FC;
             ttybuf.sg_flags |= FS;
     -------------------------------Cut Here-------------------------------------

3.16 Printers that are not simple devices

   [Firstly I'll explain the subject.] The most common example is a
printer that is connected via a network in some strange way. For
example consider a printer connected to a host with which you can only
communicate via E-mail.

   To use such a printer through `lpr' the `lp' capability of the print
queue should be directed to a `/dev/null' type device (e.g. `mknod
/dev/null1 c 1 3') but not `/dev/null' itself as `lpd' opens the device
exclusively. Each filter must must explicitly uuencode and mail its

   In more complex cases if you already have an `if' or `of' filter for
a strangely connected printer then other filters can pass their output
to/through this filter to avoid duplication of effort. In this case
the `if' filter should usually be called with the `-c' switch to
minimise the further manipulations if performs.

   I've heard someone has had some success trying something like this
with Novell NetWare and the free mail transfer agent "Charon".

3.17 Generating burst or banner pages

   For a simple text printer (in particular not PostScript) and a
simple text banner simply take `:sh:' out of the printcap record. If you
want to prevent the banner comming out in whatever font was last used
on the printer then define the `tr' "capability" to be your printer's
font reset command.

   If you want a fancy customised banner (or have a PostScript printer)
leave `:sh:' in the printcap and make each of your filters print the
banner. All the information to put on the banner is included in the
filter's positional parameters. RTFM(printcap) for details. [ If
you're using <>'s magic-filter package then call
the code to print the banners from the config script. ]

3.18 Spooling text to a PostScript printer

   You need a filter based on a program that converts ascii to
PostScript. The most well known of these is `enscript' but it's also
the hardest to find (being non-free). Others include `a2ps',
`nenscript', and `mpage'. See Also: Printing text via PostScript.

3.19 Why graphics files are sometines truncated

   This is usually because you've got a limit set on the maximum size
file that can sit in the spool queue. Put `mx#0' in your printcap.

3.20 Why `lpr -i' doesn't work

   To get `lpr -i' to work you need a filter installed as `if' that
implements it. The `-i' switch is simply passed on by `lpd' to the
filter. The filter called `lpf' that comes with `lpd' supports this
feature but can only be used to print text. If you whant to use this
program but still want your filter to do some printer specific
initialisation then write script thus:

     # My initialisation stuff goes here
     exec /usr/lib/lpf $*

   More reasonably you could have your filter script send the printer
left margin sequence.

     # This example is in perl for a change because converting numbers
     # to characters is tricky in shell script
     for ($i=0; !($_ = $ARGV[$i]) || !/^-i([0-9])+/; $i++) {}
     print pack("cAc",27,"l",$1);
     while (<STDIN>) { print; }

3.21 Why `lpr -p' doesn't work?

   Because it's broken. `lpd' always thinks that the printer is 0
characters wide regardless of what `/etc/printcap' or the `lpr'
arguemnts say. The lpd-FAQ contained a patch but it has now been
applied to lpd-590p1 and later. (Appologies to anyone who wanted this
patch after the lpd-FAQ merged with It was dropped in
the mistaken belief that a new release of lpd-590 was iminent).

   One other thing: `lpd' calls `pr' by full pathname so if you keep
`pr' somewhere different from `/usr/bin/pr' you will need a symlink.
(Where `lpd' expects to find `pr' may vary from version to version).

3.22 `lpc' and `lpq' warning of missing daemons

   One `lpd' process runs all the time and it spawns children to handle
each printer as needed. The health of the master daemon is not
explicity reported by `lpc' but the absence of errors indicates that it
is healthy. See Also: lpd not working. The `lpc stat' command will
display the message "no daemon present" for each queue that is not
actually printing at the time - this is completely normal. If printing
has been disabled or the queue is empty then this is not an error
condition. `lpq' is even more alarmist and will say "Warning: no daemon
present". If the daemon is absent when the queue has entries and has
not been explicitly stopped then this warning probably indicates an
error in a filter. Fix the filter then use `lpd up QUEUE-NAME' to
restart it.

   Sometimes when shutting down a printer `lpc' will get confused and
try to kill a non existant daemon. This leads to irritating but harmless
error messages. In lpd-590p2 these are much rarer.

3.23 Using `lpr' over a network

   To print on the printer listed as `foo' in the printcap on machine
`' from the machine `' you put an entry like
this in your `/etc/printcap' (on `'):

   and, of course, create the spool directory `/usr/lpd/spool/foo'.

   There's no point specifying filters and the like in
`' as it's the ones in
`' that will get used.

   On the machine `', you need to put `' on a
line by itself in either `/etc/hosts.equiv' or `/etc/hosts.lpd'; note
that putting it in `/etc/hosts.equiv' will allow for unauthenticated
logins as well as printing. `/etc/hosts.lpd' is for printing only.

   The machines listed in `/etc/hosts.*' should be described canonical
names or numbers as lpd starts with the IP address and performs a
revervse DNS lookup to get the name. If you are not sure of cannonical
name you can just list all the names you know for a machine. (If you
have `dig' then the command `dig -x A.B.C.D' can be used to get the
canonical name of IP address A.B.C.D.)

   If the printer server is not nunning a BSD style spooler then it
should still be possible to get it to work but the authority files may
have a different names or formats. For example Chris Nystrom
<> found that he had to create a file on the remote
machine called `/usr/spool/lp/admins/lp/Systems' that listed his Linux
box's name. We do not know if this is a SYSV thing or something
exclusive to dynix/ptx 2.0.3 that he is using on his Sequent.

   If you can't get remote printing to work thrugh lpd you may be able
to simply use remote command exectution like this:

     rsh "lp -dlp" < FILE

   This example would be for a remote system using a SYSV type printing
system on host `'.

3.24 Writing lpd filters

   In normal Un*x terminology, filters are just programs (so they must
have execute permission) that read a stream from their standard input
and write to their standard output.

   lpd filters are filters in the sense that thay read STDIN and write
to STDOUT, but are unusual in that they may assume that their standard
input is a random acess file file and may perform lseek() operations on

   All lpd filters have a common command line syntax (or more often
simply ignore command line parameters). For details of the command line
parameters RTFM(printcap).

   If you want to write a shell script filter it must have a #!/bin/sh
(or perl or csh) header. Here is the generic form of a filter to
accept PostScript.

     /PATH.../gs -q -dSAFER -dNOPAUSE -r??? -sDevice=?????? -sOutputFile=- -

   Place the full pathname of the script as one of the filters (but not
`of'!) parameter in the printcap for your printer. I suggest putting
such scripts in `/usr/lib/lpd/'. It is also usual to keep filters in
the spool directories but this goes against normal practice of keeping
programs and data neatly apart. (`-dSAFER' attempts to protect against
PostScript interpreter security holes, `-q' and `-dNOPAUSE' make it run
nonstop, and Device is the appropriate special file for your printer).

   Here is an Epson FX-80 dvi filter using ghostscript:

     /usr/TeX/bin/dvips -f | \
                   /usr/bin/gs -q -dSAFER -sDEVICE=eps9high -r120x216 \
                   -dNOPAUSE -sOutputFile=- -

   More tools useful for making filters are described elsewhere in this

3.25 Debuging lpd filters

   It's easier to debug filters if you test them in an immediate shell
before you install them. (If your filter makes use of its command line
arguments you'll have to specify them too). `my-new-filter <FILE

   A trick most people find useful when testing filters that make use of
their command line arguments is to include `echo $* >>/tmp/filter-log'
near the top of the script.

   If the filter works when you test it but still doesn't work when
called by `lpd' then you may have forgotten the `#!/bin/sh' header. You
may also need to set PATH within the script since the daemon's PATH may
not have everything you need. Note also that the filter is run with
uid=daemon so any programs it calls sould be world executable.

3.26 Output (`of') filters

   Never use these. (Well strictly speaking there are circumstances but
you're unlikey to meet them). Recently (early '94) there has been a
spate of preople on advokating the use of output filters.
Using `of' filters means that if a printout is queued while another is
already printing the 2 will be run together with a form-feed between.
Any printer initialisation or file type detection will therfore not be
performed for the second file and it will probably be printed
incorrectly. There are other more subtle ways in which output filters
can do unexpected things. IMHO: If using an output filter is the
answer, it was probably a silly question.

This is Info file, produced by Makeinfo-1.55 from
the input file printing.texinfo.

   A guide to printing and previewing files under the Linux operating

   Copyright (C) 1994 by Grant Taylor and Brian McCauley

3.27 Getting filters for given printers

   From: (Brian McCauley)

   Because writing a filter usually takes about 10 minutes once you've
found the right program (`gs', `dvilj' etc.) there's little call for
ftp archives of printer filters but we are thinking of creating an
extensive example file to go with this document.

   If you already have a program to print, say, DVI on your printer by
some mechanism then making it into a filter is usually a matter of
writting trivial shell script See Also: Writing lpd filters. If the
program you are using insists on reading a names file as input see the
next question. Text mode filters are trivial too (see this HOWTO)
unless you want lpr to have a choice of fonts in which case they are
slightly harder than trivial. You will probably want to insert and
`echo -ne' command at the beginning and end of your filter to set up
the font etc to your liking.

3.28 Filters from programs that won't read STDIN

   Some of the programs that are used in writing `lpd' filters are not
capable of taking their input from their standard input. For example
`dvilj2p' insists on a named file as its input (and what's more expects
one with a `.dvi' suffix) so do this:

     ln -s /proc/self/fd/0 /tmp/$$.dvi
     dvilj2p /tmp/$$
     rm /tmp/$$.dvi

   Note: If it wasn't for the fact that `dvilj2p' adds a `.dvi' suffix
you wouldn't need the temporary symlink and could just specify
`/proc/self/fd/0' directly. People who use this trick often usually
permanently `ln -s /proc/self/fd/0 /dev/stdin'. If you're highly
security concious and don't allow access to `/proc' you'll need to
create a temporary file.

3.29 Having many filters

   Historically the `lpr' command was created to support a finite set
of possible file types. You can, in fact, use any of the filters for any
reason. If you're never going to use Benson Varian raster files you
could use the `-v' switch for GIF files. You could even use `-d' for
low res and `-v' for high res. Remember that if you create a filter for
a file format that takes a long time to process then your printer may
sit idle between print jobs even when there are things in the queue.

   If you are on a network remember that the filter setups go on the
print server. One way to avoid running out of filter options is to
define several logical printers in `/etc/printcap' that all point to the
same physical one and put each filter in the `if' field of a different
printcap entry. This has the advantage that you can set the `PRINTER'
enviroment variable to choose your filter rather than having to specify
it on the command line each time. One small problem with this is that
you have no control over the order in which files from separate queues
are printed.

   Another (and these days more common) way to avoid running out of
possible types is to use magic filters.

3.30 Magic Filters

   Magic filters deduce their input files' types from `magic numbers'
(distictive byte patterns at particular offsets). Magic filters are
usually perl scripts, shell scripts or C programs that simply identify
the file type then call the appropriate non-magic filter. Blatent plug
:-) Brian has a generic magic filter bash script that selects the right
filter to use based on the output of the `file' command. With a
suitable magic filter (and 3 associated non-magic filters) you can do
things like:

     lpr -d file1.dvi file2.div.Z file4.texinfo.gz

   (BTW confguring `lpr' to handle texinfo files is getting a bit

   This is now on the mailserver or at:
(Although the release number will possibly change in future).

   `apsfilter' is a rather easier to use shell script that requires no
additional filters and which is pre-configured for HP compatible laser
printers. This is also available on the mailserver.

   An example written in C, which may be easily adapted to most
installations is available from the printing mail server as `lpr_if.c'.

   Magic filters should never specified as `of' as the output filter
only gets called once if a number of files are printed without a gap.
There are other more subtle problems too using `of'.

   IMHO (Brian) magic filters as `if' are inelegant as they may prevent
you, say, listing a PostScript or nroff file. (Most people disagree
with me on this point.)

3.31 Magic Filter Examples

   The following is an example of a magic shell script which should take
either PostScript or text and deal with it:

     # This is based on a script I received from Scott Doty and which was
     # written by Keith Walker. Keith's script made use of the fact that
     # lpd passes options to if:
     # <if> -w<width> -l<length> -i<indent> -n <user> -h <host> <accountingfile>
     # to print text out well at any size. This one does not. These options
     # are also handy if you want to do your own snazzy header page, much
     # like NeWSPrint from Sun does (although running PostScript through
     # the display server to get it interpreted is a bit much :)
     # gs will reset the printer anyway, so the this text setup doesn't matter.
     # setup should include the escape code for \n conversion, if applicable.
     printf "<printer setup for text printing (escape codes, etc)>"
     read first_line
     first_two_chars=`expr $first_line : '\(..\)'`
     if [ "$first_two_chars" = "%!" ]; then # it's PostScript
             /usr/bin/gs -dSAFER -dNOPAUSE -q -sDEVICE=??????? -sOutputFile=- -
     else # it's plain text
             echo -n $first_line
             printf "\014"

   Note that for the paranoid, shell scripts run as someone other than
the user are sometimes a security hole, but this is not the case with
lpd filters as the script's environment is not under the control of the
potential cracker.

4 Previewing

   These sections describe various ways to preview things under Linux -
that is, how to view them in a way approximating their final form
without printing them out.

4.1 ghostview

   Ghostview, a companion program for `gs', previews PostScript on an X
display. It also lets you select individual or ranges of pages from a
PostScript document to print using `lpr'. The new version, 1.5, has
fixed a few glitches which never bothered me but may make a difference
to you. It also calls `gs' with the `-dSAFER' option and has a few
more resource and command-line options relative to 1.4.1. The real
installation is from:

   It builds out of the box. Ghostview requires `gs' to work. The new
version of `gs', 2.6.x, will use X display fonts in an effort to
improve legibility at the low resolutions of a video monitor (a
previous failing of this pair relative to commercial display-PostScript
based systems). This works very well for me at least, at the expense
of exact character positioning (X fonts have different widths). In
fact, I thought that Ghostview looks better than Sun's pageview the
other day when I looked at the same page in oth programs side-by-side.
Ghostview/Ghostscript also has much more intelligent color handling
than pageview. You might wish to let `gs' render some Type 1 fonts you
install instead of using platform fonts (or the awful fonts `gs' comes
with. To do this while in Ghostview (or in any situation involving the
X11 driver), place `ghostscript.useExternalFonts: false' in your
`.Xdefaults' file, and the platform fonts will not be used.

   This is part of a message posted to gnu.ghostscript.bug by Tim
Theisen <>:
     (note that the usual Linux X-server, XFree, is simply an enhanced
     version of MIT's effort at an i386 X-server (X386), and does
     contain the X11R5 Type 1 rasterizer which I beleive was
     contributed by IBM.)

     Ghostscript now uses the X Toolkit to pick up X Resources. Now
     ghostscript uses the standard X rules that allow more specific
     resources to override less specific ones giving users the full
     power of X resources to control the X11 driver. It also allows
     system administrators to establish an application defaults file
     with resources specific to their ghostscript installation.

     The customization choices mentioned in make.doc have been moved
     into X resources and are now configured at run time rather than
     compile time. Sorry, this section of make.doc did not get revised
     for the 2.6.1 release.

     If `useBackingPixmap' is set, ghostscript will attempt to allocate
     a backing pixmap. If one cannot be allocated, ghostscript will
     issue a warning and ask for backing store instead. (Since there
     were insufficient resources for a backing pixmap, the X server may
     not provide backing store either.)

     Color Handling was totally revamped for gs 2.6.

     Ghostscript first checks for a suitable standard colormap. If you
     have static colormap in your X server, it would be best to store a
     standard colormap property on the root window describing the color
     layout. Ghostscript will then be able to take full advantage of
     the device. If you have a standard colormap installed,
     ghostscript will start slightly faster since it does not have to
     allocate colors for a cube or ramp.

     If no standard colormap is available, ghostscript will allocate an
     RGB cube or gray ramp. Ghostscript tries for a 5x5x5 cube on a
     color device, and a 128 gray ramp on grayscale devices. It will
     never ask for more than 1/2 of the colors for a RGB cube or gray
     ramp. It also takes into account the number of significant bits
     per pixel. (i.e. It won't ask for 128 gray levels if you only
     have 16 available.)

     Ghostscript will attempt to allocate colors that are off the color
     cube/ramp as the picture is being rendered. Ghostscript will keep
     track of 256 dynamic colors. After all these are allocated,
     ghostscript asks the X server directly.

     The foreground and background color can be set explicitly. This
     is important for the visually impaired and when using the ghostview

     Color Resources:

       1. `palette'(`Palette'): Default value: `Color'. Other
          allowable settings: `Grayscale', `Monochrome'. The palette
          resource is used to restrict the palette used for display.
          One can set palette to `Grayscale' or `Monochrome' to see how
          a file would be rendered in grayscale or monochrome on a
          color display. I use it to avoid dithering of gray- scale
          figures on a color display with 4-bit DACs.

       2. `maxGrayRamp'(`MaxGrayRamp'): Default value: 128. Maximum
          number of gray levels that ghostscript will attempt to
          allocate. (It won't try for more than this on an 8-bit
          pseudo color display even if you set it higher.) Set this
          lower if you want a smaller ramp and would prefer ghostscript
          to use dynamic colors.

       3. `maxRGBCube'(`MaxRGBCube'): Default value: 5. Maximum number
          of colors levels that ghostscript will attempt to allocate.
          (It won't try for more than this on an 8-bit pseudo color
          display even if you set it higher.) Set this lower if you
          want a smaller ramp and would prefer ghostscript to use
          dynamic colors.

     I believe these values to be a good compromise between dynamic
     allocation and fall back onto a fairly good color cube for

     You can use the foreground and background colors to accomplish
     "reverse video". However, if you have a grayscale device, it may
     be better to reverse the gray ramp using the following PostScript
     code fragment:

          [{1 exch sub} /exec load currenttransfer /exec load] cvx settransfer

     The X11 driver now supports native X11 fonts. If you have
     installed the HP XLFD font extensions into your font or X server.
     Ghostscript will also be able to use platform fonts at rotations
     of 90 degrees, with mirroring, and anamorphic scaling.

     The X11 driver does most if its work silently. You can get it to
     report when it is using an X11 font by setting the logExternalFonts
     boolean in your X resources.

     The X11 driver is setup to use the standard fonts distributed with
     X11R5. We purchased the Adobe Type Manager and the Adobe Plus
     Pack. These font packages give all the fonts normally found in
     the Apple LaserWriter Plus. The X11 driver is setup to handle
     these fonts as well. (They are a superset of the bitmap fonts
     distributed with X11.)

     You may set the regularFonts, symbolFonts, or dinbatFonts resources
     if you have different fonts available. Each font name must have 7
     dashes or it will be ignored. Minimize the use of wildcards to
     promote faster matching. (I once encountered an X server that took
     many seconds to do a font lookup when wildcards were carelessly

     There is a different list of fonts for each common encoding.
     Regular fonts may be accessed in standard or ISO Latin 1 encoding.
     The bdf files that are distributed with X11 are in the ISO Latin
     1 encoding. This leaves out the ligatures. Luckily, the
     ligatures are present in the bdf files, but are not given an
     encoding, essentially commenting them out. You can use the
     `fixfont' program from the xproof distribution
     (`Ftp.Cs.Wisc.Edu:/Pub/X/Xproof.Tar.Z', or
     `Ftp.X.Org:/Contrib/Xproof.Tar.Z') to reencode the bdf files and
     build X11 fonts that contain the ligatures (i.e standard encoding).

     If you have the Type1 fonts mentioned above, and you installed the
     Type1 rasterizer into you font or X server, you can use the
     appended fonts.scale to name your fonts so that ghostscript can
     find them.

     Font resources:

       1. `useExternalFonts'(`UseExternalFonts'): Default value: true.
          This resource controls whether X11 fonts will be used.

       2. `useScalableFonts'(`UseScalableFonts'): Default value: true.
          This resource controls whether scalable fonts will be used.
          If you have an outline scaler in your X server, you should
          have this on. If you have an X terminal, you may get
          slightly better performance with this on. If you have to use
          the X11 bitmap scaler, turn this off. Fonts scaled by the
          bitmap scaler look worse than the default ghostscript fonts.

       3. `logExternalFonts'(`LogExternalFonts'): Default value: false.
          Controls whether to report when X11 fonts are being used.

     The following fonts.scale makes all of the fonts of the Adobe Type
     Manager and Adobe Plus pack available in standard and ISO Latin 1
     encoding. (We were able to purchase the above two packages at an
     educational discount price of $150.)

agw_____.pfb -Adobe-ITC Avant Garde Gothic-Book-r-normal--0-0-0-0-p-0-iso8859-1
agwo____.pfb -Adobe-ITC Avant Garde Gothic-Book-o-normal--0-0-0-0-p-0-iso8859-1
agd_____.pfb -Adobe-ITC Avant Garde Gothic-Demi-r-normal--0-0-0-0-p-0-iso8859-1
agdo____.pfb -Adobe-ITC Avant Garde Gothic-Demi-o-normal--0-0-0-0-p-0-iso8859-1
bkl_____.pfb -Adobe-ITC Bookman-Light-r-normal--0-0-0-0-p-0-iso8859-1
bkli____.pfb -Adobe-ITC Bookman-Light-i-normal--0-0-0-0-p-0-iso8859-1
bkd_____.pfb -Adobe-ITC Bookman-Demi-r-normal--0-0-0-0-p-0-iso8859-1
bkdi____.pfb -Adobe-ITC Bookman-Demi-i-normal--0-0-0-0-p-0-iso8859-1
com_____.pfb -Adobe-Courier-Medium-r-normal--0-0-0-0-m-0-iso8859-1
coo_____.pfb -Adobe-Courier-Medium-o-normal--0-0-0-0-m-0-iso8859-1
cob_____.pfb -Adobe-Courier-Bold-r-normal--0-0-0-0-m-0-iso8859-1
cobo____.pfb -Adobe-Courier-Bold-o-normal--0-0-0-0-m-0-iso8859-1
hv______.pfb -Adobe-Helvetica-Medium-r-normal--0-0-0-0-p-0-iso8859-1
hvo_____.pfb -Adobe-Helvetica-Medium-o-normal--0-0-0-0-p-0-iso8859-1
hvb_____.pfb -Adobe-Helvetica-Bold-r-normal--0-0-0-0-p-0-iso8859-1
hvbo____.pfb -Adobe-Helvetica-Bold-o-normal--0-0-0-0-p-0-iso8859-1
hvn_____.pfb -Adobe-Helvetica-Medium-r-Narrow--0-0-0-0-p-0-iso8859-1
hvno____.pfb -Adobe-Helvetica-Medium-o-Narrow--0-0-0-0-p-0-iso8859-1
hvnb____.pfb -Adobe-Helvetica-Bold-r-Narrow--0-0-0-0-p-0-iso8859-1
hvnbo___.pfb -Adobe-Helvetica-Bold-o-Narrow--0-0-0-0-p-0-iso8859-1
ncr_____.pfb -Adobe-New Century Schoolbook-Medium-r-normal--0-0-0-0-p-0-iso8859-1
nci_____.pfb -Adobe-New Century Schoolbook-Medium-i-normal--0-0-0-0-p-0-iso8859-1
ncb_____.pfb -Adobe-New Century Schoolbook-Bold-r-normal--0-0-0-0-p-0-iso8859-1
ncbi____.pfb -Adobe-New Century Schoolbook-Bold-i-normal--0-0-0-0-p-0-iso8859-1
por_____.pfb -Adobe-Palatino-Medium-r-normal--0-0-0-0-p-0-iso8859-1
poi_____.pfb -Adobe-Palatino-Medium-i-normal--0-0-0-0-p-0-iso8859-1
pob_____.pfb -Adobe-Palatino-Bold-r-normal--0-0-0-0-p-0-iso8859-1
pobi____.pfb -Adobe-Palatino-Bold-i-normal--0-0-0-0-p-0-iso8859-1
sy______.pfb -Adobe-Symbol-Medium-r-normal--0-0-0-0-p-0-iso8859-1
tir_____.pfb -Adobe-Times-Medium-r-normal--0-0-0-0-p-0-iso8859-1
tii_____.pfb -Adobe-Times-Medium-i-normal--0-0-0-0-p-0-iso8859-1
tib_____.pfb -Adobe-Times-Bold-r-normal--0-0-0-0-p-0-iso8859-1
tibi____.pfb -Adobe-Times-Bold-i-normal--0-0-0-0-p-0-iso8859-1
zcmi____.pfb -Adobe-ITC Zapf Chancery-Medium-i-normal--0-0-0-0-p-0-iso8859-1
zd______.pfb -Adobe-ITC Zapf Dingbats-Medium-r-normal--0-0-0-0-p-0-iso8859-1
agw_____.pfb -Adobe-ITC Avant Garde Gothic-Book-r-normal--0-0-0-0-p-0-adobe-fontspecific
agwo____.pfb -Adobe-ITC Avant Garde Gothic-Book-o-normal--0-0-0-0-p-0-adobe-fontspecific
agd_____.pfb -Adobe-ITC Avant Garde Gothic-Demi-r-normal--0-0-0-0-p-0-adobe-fontspecific
agdo____.pfb -Adobe-ITC Avant Garde Gothic-Demi-o-normal--0-0-0-0-p-0-adobe-fontspecific
bkl_____.pfb -Adobe-ITC Bookman-Light-r-normal--0-0-0-0-p-0-adobe-fontspecific
bkli____.pfb -Adobe-ITC Bookman-Light-i-normal--0-0-0-0-p-0-adobe-fontspecific
bkd_____.pfb -Adobe-ITC Bookman-Demi-r-normal--0-0-0-0-p-0-adobe-fontspecific
bkdi____.pfb -Adobe-ITC Bookman-Demi-i-normal--0-0-0-0-p-0-adobe-fontspecific
com_____.pfb -Adobe-Courier-Medium-r-normal--0-0-0-0-m-0-adobe-fontspecific
coo_____.pfb -Adobe-Courier-Medium-o-normal--0-0-0-0-m-0-adobe-fontspecific
cob_____.pfb -Adobe-Courier-Bold-r-normal--0-0-0-0-m-0-adobe-fontspecific
cobo____.pfb -Adobe-Courier-Bold-o-normal--0-0-0-0-m-0-adobe-fontspecific
hv______.pfb -Adobe-Helvetica-Medium-r-normal--0-0-0-0-p-0-adobe-fontspecific
hvo_____.pfb -Adobe-Helvetica-Medium-o-normal--0-0-0-0-p-0-adobe-fontspecific
hvb_____.pfb -Adobe-Helvetica-Bold-r-normal--0-0-0-0-p-0-adobe-fontspecific
hvbo____.pfb -Adobe-Helvetica-Bold-o-normal--0-0-0-0-p-0-adobe-fontspecific
hvn_____.pfb -Adobe-Helvetica-Medium-r-Narrow--0-0-0-0-p-0-adobe-fontspecific
hvno____.pfb -Adobe-Helvetica-Medium-o-Narrow--0-0-0-0-p-0-adobe-fontspecific
hvnb____.pfb -Adobe-Helvetica-Bold-r-Narrow--0-0-0-0-p-0-adobe-fontspecific
hvnbo___.pfb -Adobe-Helvetica-Bold-o-Narrow--0-0-0-0-p-0-adobe-fontspecific
ncr_____.pfb -Adobe-New Century Schoolbook-Medium-r-normal--0-0-0-0-p-0-adobe-fontspecific
nci_____.pfb -Adobe-New Century Schoolbook-Medium-i-normal--0-0-0-0-p-0-adobe-fontspecific
ncb_____.pfb -Adobe-New Century Schoolbook-Bold-r-normal--0-0-0-0-p-0-adobe-fontspecific
ncbi____.pfb -Adobe-New Century Schoolbook-Bold-i-normal--0-0-0-0-p-0-adobe-fontspecific
por_____.pfb -Adobe-Palatino-Medium-r-normal--0-0-0-0-p-0-adobe-fontspecific
poi_____.pfb -Adobe-Palatino-Medium-i-normal--0-0-0-0-p-0-adobe-fontspecific
pob_____.pfb -Adobe-Palatino-Bold-r-normal--0-0-0-0-p-0-adobe-fontspecific
pobi____.pfb -Adobe-Palatino-Bold-i-normal--0-0-0-0-p-0-adobe-fontspecific
sy______.pfb -Adobe-Symbol-Medium-r-normal--0-0-0-0-p-0-adobe-fontspecific
tir_____.pfb -Adobe-Times-Medium-r-normal--0-0-0-0-p-0-adobe-fontspecific
tii_____.pfb -Adobe-Times-Medium-i-normal--0-0-0-0-p-0-adobe-fontspecific
tib_____.pfb -Adobe-Times-Bold-r-normal--0-0-0-0-p-0-adobe-fontspecific
tibi____.pfb -Adobe-Times-Bold-i-normal--0-0-0-0-p-0-adobe-fontspecific
zcmi____.pfb -Adobe-ITC Zapf Chancery-Medium-i-normal--0-0-0-0-p-0-adobe-fontspecific
zd______.pfb -Adobe-ITC Zapf Dingbats-Medium-r-normal--0-0-0-0-p-0-adobe-fontspecific

4.2 gspreview

   This is another front-end for Ghostscript. I have gotten and built
it, and actually preferred the user interface, but it had a few bugs.
It didn't seem as full-featured as ghostview, though. (Not that there
are all *that* many features in ghostview, but it does its job well).

4.3 xdvi

   A beautifully legible previewing program for dvi with a handy
zoom+pan feature. Will not interpret PostScript specials, which are
understood only by `dvips' (back to the compiler, object file, and now
linker analogy :-) To view a file, do `xdvi file.dvi'. This comes
with either TeX or X in most distributions. Either way, you've
probably got one. If not, look in `'.

4.4 xtex

   Xtex is similar in purpose to xdvi. I have tried to build it under
Linux and failed. It is available as:

4.5 gxditview

   Ditview produces a preview version of `troff' source using X fonts.
`groff -TX100 -mandoc MAN PAGE' will run gxditview to show you a
typeset version of the man page. `-TX75' is the same thing, but tiny.
Most distributions don't have a working one at all. A good one comes
with the source to `groff', which you might want to get anyway for the
additional drivers (some distributions are missing some, including

4.6 non-X previewing

   Ghostscript comes with pc video hardware drivers, but under un*x
these are not a good thing. However, there are `gs' binaries around
which will use the Linux VGA library (`svgalib'). The Ghostscript
device for this is called linux, thus `gs -sDEVICE=linux' will
show you an image of the PostScript. The environment variable
`GSVGAMODE' is important for this. Set it to the nuber of the video
mode you want, taken from the vga.h which comes with vgalib.

   If you need this driver, a patch to put in Linux svgalib is available
from the printing mail server or as:

   Another possibly different svgalib patch is found in:

   The plain vgalib driver is available on Sunsite.

   Texmgr is a program which will preview dvi under MGR. I don't
beleive that it currently works under Linux MGR, but if it does, MGR
uses sufficiently less memory and disk that this might be an attractive
option for some.

   dvgt is a program which will preview dvi with Linux svgalib, or on
one of several types of graphics terminals including vt, tek, or a PC
with MS-Kermit. It is available on sunsite.

5 Ascii Translation

   These sections describe various programs which can generate plain
ascii from some file formats.

5.1 from TeX

   Lametex will generate ascii from TeX source. It is available as:

   LaTeX is used by the Linux Doc Projext to generate text versions of
their manuals. I don't know where to find it.

5.2 from dvi

   `dvi2tty' is a program which will process dvi into text. Aparently,
it will also make an effort at reproducing graphics as well. I do not
know where to find it.

5.3 from PostScript

   Ghostscript 2.6.1 comes with a script file which will use `gs' to
extract just the text from a ps file, called `ps2ascii'. (*note
PostScript., for information above for where it can be found).
Further documentation is in the Ghostscript 2.6.1 distribution files
`' and `use.doc'

5.4 from troff

     groff -Tascii or -Tlatin1 ...

5.5 from ascii/latin1

   The GNU program `recode' handles conversion between various forms of
straight text encoding, ie from Latin-1 to ASCII. This is available on

Unless otherwise stated, Linux HOWTO documents are copyrighted by their
respective authors. Linux HOWTO documents may be reproduced and distributed 
in whole or in part, in any medium physical or electronic, without permission 
of the author. Translations and derivative works are similarly permitted 
without express permission. Commercial redistribution is allowed and 
encouraged; however, the author would like to be notified of any such 

In short, we wish to promote dissemination of this information through as many channels as possible. However, we do wish to retain copyright on the HOWTO documents, and would like to be notified of any plans to redistribute the HOWTOs. If you have questions, please contact Matt Welsh, the Linux HOWTO coordinator, at ---------- X-Sun-Data-Type: postscript-file X-Sun-Data-Description: postscript-file X-Sun-Data-Name: X-Sun-Charset: us-ascii X-Sun-Content-Lines: 4316

%!PS-Adobe-1.0 %%Creator: kappa:rich (Richard Murphey,AL C105,3649,529-4459) %%Title: stdin (ditroff) %%CreationDate: Wed May 27 16:40:57 1992 %%EndComments % Start of -- prolog for ditroff translator % Copyright (c) 1985,1987 Adobe Systems Incorporated. All Rights Reserved. % GOVERNMENT END USERS: See Notice file in TranScript library directory % -- probably /usr/lib/ps/Notice % RCS: $Header:,v 2.2 87/11/17 16:40:42 byron Rel $ /$DITroff 140 dict def $DITroff begin /fontnum 1 def /fontsize 10 def /fontheight 10 def /fontslant 0 def /xi {0 72 11 mul translate 72 resolution div dup neg scale 0 0 moveto /fontnum 1 def /fontsize 10 def /fontheight 10 def /fontslant 0 def F /pagesave save def}def /PB{save /psv exch def currentpoint translate resolution 72 div dup neg scale 0 0 moveto}def /PE{psv restore}def /m1 matrix def /m2 matrix def /m3 matrix def /oldmat matrix def /tan{dup sin exch cos div}bind def /point{resolution 72 div mul}bind def /dround {transform round exch round exch itransform}bind def /xT{/devname exch def}def /xr{/mh exch def /my exch def /resolution exch def}def /xp{}def /xs{docsave restore end}def /xt{}def /xf{/fontname exch def /slotno exch def fontnames slotno get fontname eq not {fonts slotno fontname findfont put fontnames slotno fontname put}if}def /xH{/fontheight exch def F}bind def /xS{/fontslant exch def F}bind def /s{/fontsize exch def /fontheight fontsize def F}bind def /f{/fontnum exch def F}bind def /F{fontheight 0 le {/fontheight fontsize def}if fonts fontnum get fontsize point 0 0 fontheight point neg 0 0 m1 astore fontslant 0 ne{1 0 fontslant tan 1 0 0 m2 astore m3 concatmatrix}if makefont setfont .04 fontsize point mul 0 dround pop setlinewidth}bind def /X{exch currentpoint exch pop moveto show}bind def /N{3 1 roll moveto show}bind def /Y{exch currentpoint pop exch moveto show}bind def /S /show load def /ditpush{}def/ditpop{}def /AX{3 -1 roll currentpoint exch pop moveto 0 exch ashow}bind def /AN{4 2 roll moveto 0 exch ashow}bind def /AY{3 -1 roll currentpoint pop exch moveto 0 exch ashow}bind def /AS{0 exch ashow}bind def /MX{currentpoint exch pop moveto}bind def /MY{currentpoint pop exch moveto}bind def /MXY /moveto load def /cb{pop}def % action on unknown char -- nothing for now /n{}def/w{}def /p{pop showpage pagesave restore /pagesave save def}def /abspoint{currentpoint exch pop add exch currentpoint pop add exch}def /dstroke{currentpoint stroke moveto}bind def /Dl{2 copy gsave rlineto stroke grestore rmoveto}bind def /arcellipse{oldmat currentmatrix pop currentpoint translate 1 diamv diamh div scale /rad diamh 2 div def rad 0 rad -180 180 arc oldmat setmatrix}def /Dc{gsave dup /diamv exch def /diamh exch def arcellipse dstroke grestore diamh 0 rmoveto}def /De{gsave /diamv exch def /diamh exch def arcellipse dstroke grestore diamh 0 rmoveto}def /Da{currentpoint /by exch def /bx exch def /fy exch def /fx exch def /cy exch def /cx exch def /rad cx cx mul cy cy mul add sqrt def /ang1 cy neg cx neg atan def /ang2 fy fx atan def cx bx add cy by add 2 copy rad ang1 ang2 arcn stroke exch fx add exch fy add moveto}def /Barray 200 array def % 200 values in a wiggle /D~{mark}def /D~~{counttomark Barray exch 0 exch getinterval astore /Bcontrol exch def pop /Blen Bcontrol length def Blen 4 ge Blen 2 mod 0 eq and {Bcontrol 0 get Bcontrol 1 get abspoint /Ycont exch def /Xcont exch def Bcontrol 0 2 copy get 2 mul put Bcontrol 1 2 copy get 2 mul put Bcontrol Blen 2 sub 2 copy get 2 mul put Bcontrol Blen 1 sub 2 copy get 2 mul put /Ybi /Xbi currentpoint 3 1 roll def def 0 2 Blen 4 sub {/i exch def Bcontrol i get 3 div Bcontrol i 1 add get 3 div Bcontrol i get 3 mul Bcontrol i 2 add get add 6 div Bcontrol i 1 add get 3 mul Bcontrol i 3 add get add 6 div /Xbi Xcont Bcontrol i 2 add get 2 div add def /Ybi Ycont Bcontrol i 3 add get 2 div add def /Xcont Xcont Bcontrol i 2 add get add def /Ycont Ycont Bcontrol i 3 add get add def Xbi currentpoint pop sub Ybi currentpoint exch pop sub rcurveto }for dstroke}if}def end /ditstart{$DITroff begin /nfonts 60 def % NFONTS makedev/ditroff dependent! /fonts[nfonts{0}repeat]def /fontnames[nfonts{()}repeat]def /docsave save def }def

% character outcalls /oc {/pswid exch def /cc exch def /name exch def /ditwid pswid fontsize mul resolution mul 72000 div def /ditsiz fontsize resolution mul 72 div def ocprocs name known{ocprocs name get exec}{name cb} ifelse}def /fractm [.65 0 0 .6 0 0] def /fraction {/fden exch def /fnum exch def gsave /cf currentfont def cf fractm makefont setfont 0 .3 dm 2 copy neg rmoveto fnum show rmoveto currentfont cf setfont(\244)show setfont fden show grestore ditwid 0 rmoveto} def /oce {grestore ditwid 0 rmoveto}def /dm {ditsiz mul}def /ocprocs 50 dict def ocprocs begin (14){(1)(4)fraction}def (12){(1)(2)fraction}def (34){(3)(4)fraction}def (13){(1)(3)fraction}def (23){(2)(3)fraction}def (18){(1)(8)fraction}def (38){(3)(8)fraction}def (58){(5)(8)fraction}def (78){(7)(8)fraction}def (sr){gsave .05 dm .16 dm rmoveto(\326)show oce}def (is){gsave 0 .15 dm rmoveto(\362)show oce}def (->){gsave 0 .02 dm rmoveto(\256)show oce}def (<-){gsave 0 .02 dm rmoveto(\254)show oce}def (==){gsave 0 .05 dm rmoveto(\272)show oce}def end % DIThacks fonts for some special chars 50 dict dup begin /FontType 3 def /FontName /DIThacks def /FontMatrix [.001 0.0 0.0 .001 0.0 0.0] def /FontBBox [-220 -280 900 900] def% a lie but ... /Encoding 256 array def 0 1 255{Encoding exch /.notdef put}for Encoding dup 8#040/space put %space dup 8#110/rc put %right ceil dup 8#111/lt put %left top curl dup 8#112/bv put %bold vert dup 8#113/lk put %left mid curl dup 8#114/lb put %left bot curl dup 8#115/rt put %right top curl dup 8#116/rk put %right mid curl dup 8#117/rb put %right bot curl dup 8#120/rf put %right floor dup 8#121/lf put %left floor dup 8#122/lc put %left ceil dup 8#140/sq put %square dup 8#141/bx put %box dup 8#142/ci put %circle dup 8#143/br put %box rule dup 8#144/rn put %root extender dup 8#145/vr put %vertical rule dup 8#146/ob put %outline bullet dup 8#147/bu put %bullet dup 8#150/ru put %rule dup 8#151/ul put %underline pop /DITfd 100 dict def /BuildChar{0 begin /cc exch def /fd exch def /charname fd /Encoding get cc get def /charwid fd /Metrics get charname get def /charproc fd /CharProcs get charname get def charwid 0 fd /FontBBox get aload pop setcachedevice 40 setlinewidth newpath 0 0 moveto gsave charproc grestore end}def /BuildChar load 0 DITfd put %/UniqueID 5 def /CharProcs 50 dict def CharProcs begin /space{}def /.notdef{}def /ru{500 0 rls}def /rn{0 750 moveto 500 0 rls}def /vr{20 800 moveto 0 -770 rls}def /bv{20 800 moveto 0 -1000 rls}def /br{20 770 moveto 0 -1040 rls}def /ul{0 -250 moveto 500 0 rls}def /ob{200 250 rmoveto currentpoint newpath 200 0 360 arc closepath stroke}def /bu{200 250 rmoveto currentpoint newpath 200 0 360 arc closepath fill}def /sq{80 0 rmoveto currentpoint dround newpath moveto 640 0 rlineto 0 640 rlineto -640 0 rlineto closepath stroke}def /bx{80 0 rmoveto currentpoint dround newpath moveto 640 0 rlineto 0 640 rlineto -640 0 rlineto closepath fill}def /ci{355 333 rmoveto currentpoint newpath 333 0 360 arc 50 setlinewidth stroke}def

/lt{20 -200 moveto 0 550 rlineto currx 800 2cx s4 add exch s4 a4p stroke}def /lb{20 800 moveto 0 -550 rlineto currx -200 2cx s4 add exch s4 a4p stroke}def /rt{20 -200 moveto 0 550 rlineto currx 800 2cx s4 sub exch s4 a4p stroke}def /rb{20 800 moveto 0 -500 rlineto currx -200 2cx s4 sub exch s4 a4p stroke}def /lk{20 800 moveto 20 300 -280 300 s4 arcto pop pop 1000 sub currentpoint stroke moveto 20 300 4 2 roll s4 a4p 20 -200 lineto stroke}def /rk{20 800 moveto 20 300 320 300 s4 arcto pop pop 1000 sub currentpoint stroke moveto 20 300 4 2 roll s4 a4p 20 -200 lineto stroke}def /lf{20 800 moveto 0 -1000 rlineto s4 0 rls}def /rf{20 800 moveto 0 -1000 rlineto s4 neg 0 rls}def /lc{20 -200 moveto 0 1000 rlineto s4 0 rls}def /rc{20 -200 moveto 0 1000 rlineto s4 neg 0 rls}def end

/Metrics 50 dict def Metrics begin /.notdef 0 def /space 500 def /ru 500 def /br 0 def /lt 250 def /lb 250 def /rt 250 def /rb 250 def /lk 250 def /rk 250 def /rc 250 def /lc 250 def /rf 250 def /lf 250 def /bv 250 def /ob 350 def /bu 350 def /ci 750 def /bx 750 def /sq 750 def /rn 500 def /ul 500 def /vr 0 def end

DITfd begin /s2 500 def /s4 250 def /s3 333 def /a4p{arcto pop pop pop pop}def /2cx{2 copy exch}def /rls{rlineto stroke}def /currx{currentpoint pop}def /dround{transform round exch round exch itransform} def end end /DIThacks exch definefont pop

ditstart (psc)xT 576 1 1 xr 1(Times-Roman)xf 1 f 2(Times-Italic)xf 2 f 3(Times-Bold)xf 3 f 4(Times-BoldItalic)xf 4 f 5(Helvetica)xf 5 f 6(Helvetica-Bold)xf 6 f 7(Courier)xf 7 f 8(Courier-Bold)xf 8 f 9(Symbol)xf 9 f 10(DIThacks)xf 10 f 10 s 1 f xi %%EndProlog

%%Page: 1 1 10 s 0 xH 0 xS 1 f 8 s 3 f 12 s 1521 984(4.3BSD)N 1851(Line)X 2062(Printer)X 2386(Spooler)X 2725(Manual)X 2 f 10 s 2022 1176(Ralph)N 2233(Campbell)X 1 f 1710 1320(Computer)N 2050(Systems)X 2336(Research)X 2651(Group)X 1840 1416(Computer)N 2180(Science)X 2450(Division)X 1307 1512(Department)N 1706(of)X 1793(Electrical)X 2121(Engineering)X 2533(and)X 2669(Computer)X 3009(Science)X 1733 1608(University)N 2091(of)X 2178(California,)X 2543(Berkeley)X 1942 1704(Berkeley,)N 2272(CA)X 2423(94720)X 2 f 2094 1992(ABSTRACT)N 1 f 1043 2184(This)N 1206(document)X 1543(describes)X 1863(the)X 1982(structure)X 2284(and)X 2420(installation)X 2795(procedure)X 3137(for)X 3251(the)X 3369(line)X 3509(printer)X 843 2280(spooling)N 1138(system)X 1380(developed)X 1730(for)X 1844(the)X 1962(4.3BSD)X 2237(version)X 2493(of)X 2580(the)X 2698(UNIX*)X 2959(operating)X 3282(system.)X 843 2596(Revised)N 1121(April)X 1310(17,)X 1430(1991)X 3 f 555 2884(1.)N 655(Overview)X 1 f 755 3008(The)N 900(line)X 1040(printer)X 1274(system)X 1516(supports:)X 10 f 555 3132(g)N 1 f 675(multiple)X 961(printers,)X 10 f 555 3256(g)N 1 f 675(multiple)X 961(spooling)X 1256(queues,)X 10 f 555 3380(g)N 1 f 675(both)X 837(local)X 1013(and)X 1149(remote)X 1392(printers,)X 1677(and)X 10 f 555 3504(g)N 1 f 675(printers)X 940(attached)X 1228(via)X 1346(serial)X 1540(lines)X 1711(that)X 1851(require)X 2099(line)X 2239(initialization)X 2663(such)X 2830(as)X 2917(the)X 3035(baud)X 3211(rate.)X 555 3628(Raster)N 780(output)X 1004(devices)X 1265(such)X 1432(as)X 1519(a)X 1575(Varian)X 1814(or)X 1901(Versatec,)X 2223(and)X 2359(laser)X 2531(printers)X 2796(such)X 2963(as)X 3050(an)X 3146(Imagen,)X 3427(are)X 3546(also)X 3695(supported)X 555 3724(by)N 655(the)X 773(line)X 913(printer)X 1147(system.)X 755 3848(The)N 900(line)X 1040(printer)X 1274(system)X 1516(consists)X 1789(mainly)X 2031(of)X 2118(the)X 2236(following)X 2567(\256les)X 2720(and)X 2856(commands:)X 843 4040(/etc/printcap)N 1394(printer)X 1628(con\256guration)X 2075(and)X 2211(capability)X 2547(data)X 2701(base)X 843 4136(/usr/lib/lpd)N 1394(line)X 1534(printer)X 1768(daemon,)X 2062(does)X 2229(all)X 2329(the)X 2447(real)X 2588(work)X 843 4232(/usr/ucb/lpr)N 1394(program)X 1686(to)X 1768(enter)X 1949(a)X 2005(job)X 2127(in)X 2209(a)X 2265(printer)X 2499(queue)X 843 4328(/usr/ucb/lpq)N 1394(spooling)X 1689(queue)X 1901(examination)X 2317(program)X 843 4424(/usr/ucb/lprm)N 1394(program)X 1686(to)X 1768(delete)X 1980(jobs)X 2133(from)X 2309(a)X 2365(queue)X 843 4520(/etc/lpc)N 1394(program)X 1686(to)X 1768(administer)X 2126(printers)X 2391(and)X 2527(spooling)X 2822(queues)X 843 4616(/dev/printer)N 1394(socket)X 1619(on)X 1719(which)X 1935(lpd)X 2057(listens)X 555 4808(The)N 703(\256le)X 828(/etc/printcap)X 1252(is)X 1328(a)X 1387(master)X 1624(data)X 1781(base)X 1946(describing)X 2302(line)X 2444(printers)X 2711(directly)X 2978(attached)X 3268(to)X 3352(a)X 3410(machine)X 3704(and,)X 3862(also,)X 555 4904(printers)N 846(accessible)X 1218(across)X 1465(a)X 1546(network.)X 1874(The)X 2044(manual)X 2325(page)X 2522(entry)X 2 f 2732(printcap)X 1 f 3003(\(5\))X 3142(provides)X 3463(the)X 3606(authoritative)X 555 5000(de\256nition)N 887(of)X 980(the)X 1104(format)X 1344(of)X 1437(this)X 1578(data)X 1738(base,)X 1927(as)X 2020(well)X 2184(as)X 2277(specifying)X 2637(default)X 2886(values)X 3117(for)X 3237(important)X 3574(items)X 3772(such)X 3944(as)X 555 5096(the)N 676(directory)X 989(in)X 1074(which)X 1293(spooling)X 1591(is)X 1667(performed.)X 2065(This)X 2230(document)X 2569(introduces)X 2926(some)X 3118(of)X 3208(the)X 3329(information)X 3730(that)X 3873(may)X 555 5192(be)N 651(placed)X 2 f 881(printcap)X 1 f 1152(.)X 8 s 10 f 555 5584(hhhhhhhhhhhhhhhhhh)N 1 f 555 5664(*)N 603(UNIX)X 778(is)X 837(a)X 881(trademark)X 1155(of)X 1224(Bell)X 1347(Laboratories.)X

2 p %%Page: 2 2 8 s 0 xH 0 xS 1 f 10 s 555 384(SMM:6-2)N 2817(4.3BSD)X 3092(Line)X 3259(Printer)X 3497(Spooler)X 3766(Manual)X 3 f 555 672(2.)N 655(Commands)X 555 864(2.1.)N 715(lpd)X 9 f 845(-)X 3 f 909(line)X 1053(printer)X 1318(daemon)X 1 f 755 988(The)N 910(program)X 2 f 1212(lpd)X 1 f 1314(\(8\),)X 1458(usually)X 1719(invoked)X 2007(at)X 2095(boot)X 2267(time)X 2439(from)X 2625(the)X 2752(/etc/rc)X 2982(\256le,)X 3133(acts)X 3287(as)X 3383(a)X 3448(master)X 3691(server)X 3917(for)X 555 1084(coordinating)N 991(and)X 1138(controlling)X 1520(the)X 1649(spooling)X 1955(queues)X 2209(con\256gured)X 2583(in)X 2676(the)X 2805(printcap)X 3099(\256le.)X 3272(When)X 2 f 3495(lpd)X 1 f 3640(is)X 3723(started)X 3967(it)X 555 1180(makes)N 784(a)X 843(single)X 1057(pass)X 1218(through)X 1490(the)X 2 f 1611(printcap)X 1 f 1918(database)X 2218(restarting)X 2544(any)X 2683(printers)X 2951(that)X 3094(have)X 3269(jobs.)X 3465(In)X 3555(normal)X 3805(opera-)X 555 1276(tion)N 2 f 703(lpd)X 1 f 842(listens)X 1070(for)X 1188(service)X 1440(requests)X 1727(on)X 1831(multiple)X 2121(sockets,)X 2401(one)X 2541(in)X 2627(the)X 2749(UNIX)X 2974(domain)X 3238(\(named)X 3502(``/dev/printer''\))X 555 1372(for)N 676(local)X 859(requests,)X 1169(and)X 1312(one)X 1454(in)X 1542(the)X 1666(Internet)X 1942(domain)X 2208(\(under)X 2444(the)X 2568(``printer'')X 2916(service)X 3170(speci\256cation\))X 3628(for)X 3748(requests)X 555 1468(for)N 679(printer)X 922(access)X 1157(from)X 1342(off)X 1465(machine;)X 1788(see)X 2 f 1920(socket)X 1 f 2134(\(2\))X 2257(and)X 2 f 2402(services)X 1 f 2674(\(5\))X 2797(for)X 2920(more)X 3114(information)X 3521(on)X 3630(sockets)X 3895(and)X 555 1564(service)N 806(speci\256cations,)X 1284(respectively.)X 2 f 1734(Lpd)X 1 f 1893(spawns)X 2151(a)X 2209(copy)X 2387(of)X 2476(itself)X 2658(to)X 2742(process)X 3005(the)X 3125(request;)X 3401(the)X 3521(master)X 3757(daemon)X 555 1660(continues)N 882(to)X 964(listen)X 1157(for)X 1271(new)X 1425(requests.)X 755 1784(Clients)N 1023(communicate)X 1497(with)X 2 f 1681(lpd)X 1 f 1837(using)X 2051(a)X 2128(simple)X 2382(transaction)X 2775(oriented)X 3079(protocol.)X 3427(Authentication)X 3944(of)X 555 1880(remote)N 804(clients)X 1039(is)X 1118(done)X 1300(based)X 1509(on)X 1615(the)X 1739(``privilege)X 2103(port'')X 2311(scheme)X 2577(employed)X 2918(by)X 2 f 3023(rshd)X 1 f 3178(\(8C\))X 3350(and)X 2 f 3491(rcmd)X 1 f 3669(\(3X\).)X 3886(The)X 555 1976(following)N 892(table)X 1074(shows)X 1300(the)X 1424(requests)X 1713(understood)X 2094(by)X 2 f 2199(lpd)X 1 f 2301(.)X 2366(In)X 2458(each)X 2631(request)X 2888(the)X 3011(\256rst)X 3160(byte)X 3323(indicates)X 3633(the)X 3756(``mean-)X 555 2072(ing'')N 731(of)X 818(the)X 936(request,)X 1208(followed)X 1513(by)X 1613(the)X 1731(name)X 1925(of)X 2012(the)X 2130(printer)X 2364(to)X 2446(which)X 2662(it)X 2726(should)X 2959(be)X 3055(applied.)X 3351(Additional)X 3713(quali\256ers)X 555 2168(may)N 713(follow,)X 962(depending)X 1316(on)X 1416(the)X 1534(request.)X 843 2360(Request)N 2155(Interpretation)X 10 f 843 2376(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)N 1 f 843 2472(\303Aprinter\\n)N 2155(check)X 2363(the)X 2481(queue)X 2693(for)X 2807(jobs)X 2960(and)X 3096(print)X 3267(any)X 3403(found)X 843 2568(\303Bprinter\\n)N 2155(receive)X 2408(and)X 2544(queue)X 2756(a)X 2812(job)X 2934(from)X 3110(another)X 3371(machine)X 843 2664(\303Cprinter)N 1157([users)X 1369(...])X 1476([jobs)X 1656(...]\\n)X 2155(return)X 2367(short)X 2547(list)X 2664(of)X 2751(current)X 2999(queue)X 3211(state)X 843 2760(\303Dprinter)N 1162([users)X 1374(...])X 1481([jobs)X 1661(...]\\n)X 2155(return)X 2367(long)X 2529(list)X 2646(of)X 2733(current)X 2981(queue)X 3193(state)X 843 2856(\303Eprinter)N 1153(person)X 1387([users)X 1599(...])X 1706([jobs)X 1886(...]\\n)X 2155(remove)X 2416(jobs)X 2569(from)X 2745(a)X 2801(queue)X 755 3076(The)N 2 f 903(lpr)X 1 f 1009(\(1\))X 1126(command)X 1465(is)X 1541(used)X 1711(by)X 1814(users)X 2002(to)X 2087(enter)X 2271(a)X 2330(print)X 2504(job)X 2629(in)X 2713(a)X 2771(local)X 2949(queue)X 3163(and)X 3301(to)X 3385(notify)X 3598(the)X 3718(local)X 2 f 3896(lpd)X 1 f 555 3172(that)N 699(there)X 884(are)X 1007(new)X 1165(jobs)X 1322(in)X 1408(the)X 1530(spooling)X 1829(area.)X 2 f 2028(Lpd)X 1 f 2189(either)X 2395(schedules)X 2730(the)X 2851(job)X 2976(to)X 3061(be)X 3160(printed)X 3410(locally,)X 3671(or)X 3761(if)X 3833(print-)X 555 3268(ing)N 678(remotely,)X 1004(attempts)X 1296(to)X 1379(forward)X 1655(the)X 1774(job)X 1897(to)X 1980(the)X 2099(appropriate)X 2486(machine.)X 2818(If)X 2892(the)X 3010(printer)X 3244(cannot)X 3478(be)X 3574(opened)X 3826(or)X 3913(the)X 555 3364(destination)N 926(machine)X 1218(is)X 1291(unreachable,)X 1720(the)X 1838(job)X 1960(will)X 2104(remain)X 2347(queued)X 2599(until)X 2765(it)X 2829(is)X 2902(possible)X 3184(to)X 3266(complete)X 3580(the)X 3698(work.)X 3 f 555 3556(2.2.)N 715(lpq)X 9 f 845(-)X 3 f 909(show)X 1102(line)X 1246(printer)X 1511(queue)X 1 f 755 3680(The)N 2 f 915(lpq)X 1 f 1030(\(1\))X 1159(program)X 1466(works)X 1697(recursively)X 2089(backwards)X 2468(displaying)X 2836(the)X 2969(queue)X 3196(of)X 3298(the)X 3431(machine)X 3737(with)X 3913(the)X 555 3776(printer)N 792(and)X 931(then)X 1092(the)X 1213(queue\(s\))X 1512(of)X 1601(the)X 1721(machine\(s\))X 2100(that)X 2242(lead)X 2398(to)X 2482(it.)X 2 f 2588(Lpq)X 1 f 2747(has)X 2876(two)X 3018(forms)X 3227(of)X 3316(output:)X 3564(in)X 3648(the)X 3768(default,)X 555 3872(short,)N 757(format)X 993(it)X 1059(gives)X 1250(a)X 1308(single)X 1521(line)X 1663(of)X 1752(output)X 1978(per)X 2103(queued)X 2357(job;)X 2503(in)X 2587(the)X 2707(long)X 2871(format)X 3107(it)X 3173(shows)X 3395(the)X 3515(list)X 3633(of)X 3721(\256les,)X 3895(and)X 555 3968(their)N 722(sizes,)X 918(that)X 1058(comprise)X 1372(a)X 1428(job.)X 3 f 555 4160(2.3.)N 715(lprm)X 9 f 904(-)X 3 f 968(remove)X 1243(jobs)X 1405(from)X 1595(a)X 1655(queue)X 1 f 755 4284(The)N 2 f 901(lprm)X 1 f 1065(\(1\))X 1180(command)X 1517(deletes)X 1761(jobs)X 1915(from)X 2092(a)X 2148(spooling)X 2443(queue.)X 2695(If)X 2769(necessary,)X 2 f 3122(lprm)X 1 f 3293(will)X 3437(\256rst)X 3581(kill)X 3707(off)X 3821(a)X 3877(run-)X 555 4380(ning)N 720(daemon)X 997(that)X 1139(is)X 1214(servicing)X 1530(the)X 1650(queue)X 1864(and)X 2002(restart)X 2225(it)X 2291(after)X 2461(the)X 2581(required)X 2871(\256les)X 3026(are)X 3147(removed.)X 3490(When)X 3704(removing)X 555 4476(jobs)N 710(destined)X 998(for)X 1113(a)X 1170(remote)X 1414(printer,)X 2 f 1669(lprm)X 1 f 1841(acts)X 1987(similarly)X 2292(to)X 2 f 2375(lpq)X 1 f 2498(except)X 2729(it)X 2794(\256rst)X 2939(checks)X 3179(locally)X 3418(for)X 3533(jobs)X 3687(to)X 3770(remove)X 555 4572(and)N 691(then)X 849(tries)X 1007(to)X 1089(remove)X 1350(\256les)X 1503(in)X 1585(queues)X 1828(off-machine.)X 3 f 555 4764(2.4.)N 715(lpc)X 9 f 837(-)X 3 f 901(line)X 1045(printer)X 1310(control)X 1575(program)X 1 f 755 4888(The)N 2 f 909(lpc)X 1 f 1007(\(8\))X 1130(program)X 1431(is)X 1512(used)X 1687(by)X 1795(the)X 1921(system)X 2171(administrator)X 2626(to)X 2716(control)X 2971(the)X 3097(operation)X 3428(of)X 3523(the)X 3649(line)X 3797(printer)X 555 4984(system.)N 817(For)X 948(each)X 1116(line)X 1256(printer)X 1490(con\256gured)X 1853(in)X 1935(/etc/printcap,)X 2 f 2376(lpc)X 1 f 2507(may)X 2665(be)X 2761(used)X 2928(to:)X 10 f 555 5108(g)N 1 f 755(disable)X 1002(or)X 1089(enable)X 1319(a)X 1375(printer,)X 10 f 555 5232(g)N 1 f 755(disable)X 1002(or)X 1089(enable)X 1319(a)X 1375(printer's)X 1667(spooling)X 1962(queue,)X 10 f 555 5356(g)N 1 f 755 0.3906(rearrange)AX 1080(the)X 1198(order)X 1388(of)X 1475(jobs)X 1628(in)X 1710(a)X 1766(spooling)X 2061(queue,)X 10 f 555 5480(g)N 1 f 755(\256nd)X 899(the)X 1017(status)X 1219(of)X 1306(printers,)X 1591(and)X 1727(their)X 1894(associated)X 2244(spooling)X 2539(queues)X 2782(and)X 2918(printer)X 3152(daemons.)X

3 p %%Page: 3 3 10 s 0 xH 0 xS 1 f 555 384(4.3BSD)N 830(Line)X 997(Printer)X 1235(Spooler)X 1504(Manual)X 3696(SMM:6-3)X 3 f 555 672(3.)N 655(Access)X 903(control)X 1 f 755 796(The)N 922(printer)X 1178(system)X 1442(maintains)X 1795(protected)X 2136(spooling)X 2453(areas)X 2661(so)X 2773(that)X 2934(users)X 3140(cannot)X 3395(circumvent)X 3797(printer)X 555 892(accounting)N 931(or)X 1022(remove)X 1287(\256les)X 1444(other)X 1633(than)X 1795(their)X 1965(own.)X 2166(The)X 2314(strategy)X 2591(used)X 2761(to)X 2846(maintain)X 3149(protected)X 3471(spooling)X 3769(areas)X 3958(is)X 555 988(as)N 642(follows:)X 10 f 555 1112(g)N 1 f 675(The)X 820(spooling)X 1115(area)X 1270(is)X 1343(writable)X 1626(only)X 1788(by)X 1888(a)X 2 f 1944(daemon)X 1 f 2218(user)X 2372(and)X 2 f 2508(daemon)X 1 f 2782(group.)X 10 f 555 1236(g)N 1 f 675(The)X 2 f 828(lpr)X 1 f 949(program)X 1249(runs)X 1415(set-user-id)X 1782(to)X 2 f 1872(root)X 1 f 2033(and)X 2177(set-group-id)X 2597(to)X 2687(group)X 2 f 2902(daemon)X 1 f 3156(.)X 3224(The)X 2 f 3377(root)X 1 f 3538(access)X 3771(permits)X 675 1332(reading)N 940(any)X 1080(\256le)X 1206(required.)X 1518(Accessibility)X 1960(is)X 2037(veri\256ed)X 2306(with)X 2472(an)X 2 f 2572(access)X 1 f 2795(\(2\))X 2913(call.)X 3093(The)X 3242(group)X 3453(ID)X 3562(is)X 3639(used)X 3810(in)X 3895(set-)X 675 1428(ting)N 819(up)X 919(proper)X 1149(ownership)X 1503(of)X 1590(\256les)X 1743(in)X 1825(the)X 1943(spooling)X 2238(area)X 2393(for)X 2 f 2507(lprm)X 1 f 2658(.)X 10 f 555 1552(g)N 1 f 675(Control)X 942(\256les)X 1098(in)X 1183(a)X 1242(spooling)X 1540(area)X 1698(are)X 1820(made)X 2017(with)X 2 f 2182(daemon)X 1 f 2459(ownership)X 2816(and)X 2955(group)X 3165(ownership)X 2 f 3521(daemon)X 1 f 3775(.)X 3837(Their)X 675 1648(mode)N 880(is)X 960(0660.)X 1187(This)X 1356(insures)X 1610(control)X 1864(\256les)X 2024(are)X 2150(not)X 2279(modi\256ed)X 2590(by)X 2697(a)X 2759(user)X 2919(and)X 3061(that)X 3207(no)X 3313(user)X 3473(can)X 3611(remove)X 3878(\256les)X 675 1744(except)N 905(through)X 2 f 1174(lprm)X 1 f 1325(.)X 10 f 555 1868(g)N 1 f 675(The)X 825(spooling)X 1125(programs,)X 2 f 1473(lpd)X 1 f 1575(,)X 2 f 1620(lpq)X 1 f 1722(,)X 1766(and)X 2 f 1906(lprm)X 1 f 2081(run)X 2212(set-user-id)X 2575(to)X 2 f 2661(root)X 1 f 2818(and)X 2958(set-group-id)X 3374(to)X 3460(group)X 2 f 3671(daemon)X 1 f 3949(to)X 675 1964(access)N 901(spool)X 1094(\256les)X 1247(and)X 1383(printers.)X 10 f 555 2088(g)N 1 f 675(The)X 834(printer)X 1082(server,)X 2 f 1332(lpd)X 1 f 1434(,)X 1487(uses)X 1658(the)X 1789(same)X 1987(veri\256cation)X 2385(procedures)X 2771(as)X 2 f 2871(rshd)X 1 f 3026(\(8C\))X 3206(in)X 3301(authenticating)X 3788(remote)X 675 2184(clients.)N 949(The)X 1099(host)X 1257(on)X 1362(which)X 1583(a)X 1644(client)X 1847(resides)X 2095(must)X 2275(be)X 2376(present)X 2633(in)X 2720(the)X 2843(\256le)X 2970(/etc/hosts.equiv)X 3495(or)X 3587(/etc/hosts.lpd)X 675 2280(and)N 811(the)X 929(request)X 1181(message)X 1473(must)X 1648(come)X 1842(from)X 2018(a)X 2074(reserved)X 2367(port)X 2516(number.)X 755 2404(In)N 844(practice,)X 1141(none)X 1319(of)X 2 f 1408(lpd)X 1 f 1510(,)X 2 f 1552(lpq)X 1 f 1654(,)X 1696(or)X 2 f 1785(lprm)X 1 f 1958(would)X 2180(have)X 2354(to)X 2437(run)X 2565(as)X 2653(user)X 2 f 2808(root)X 1 f 2962(if)X 3032(remote)X 3276(spooling)X 3572(were)X 3750(not)X 3873(sup-)X 555 2500(ported.)N 824(In)X 915(previous)X 1215(incarnations)X 1631(of)X 1722(the)X 1844(printer)X 2082(system)X 2 f 2328(lpd)X 1 f 2454(ran)X 2580(set-user-id)X 2942(to)X 2 f 3027(daemon)X 1 f 3281(,)X 3324(set-group-id)X 3739(to)X 3824(group)X 2 f 555 2596(spooling)N 1 f 830(,)X 870(and)X 2 f 1006(lpq)X 1 f 1128(and)X 2 f 1264(lprm)X 1 f 1435(ran)X 1558(set-group-id)X 1970(to)X 2052(group)X 2 f 2259(spooling)X 1 f 2534(.)X 3 f 555 2788(4.)N 655(Setting)X 915(up)X 1 f 755 2912(The)N 910(4.3BSD)X 1194(release)X 1447(comes)X 1681(with)X 1852(the)X 1979(necessary)X 2321(programs)X 2653(installed)X 2953(and)X 3098(with)X 3269(the)X 3396(default)X 3648(line)X 3797(printer)X 555 3008(queue)N 774(created.)X 1074(If)X 1155(the)X 1280(system)X 1529(must)X 1711(be)X 1814(modi\256ed,)X 2145(the)X 2269(make\256le)X 2571(in)X 2659(the)X 2783(directory)X 3099(/usr/src/usr.lib/lpr)X 3696(should)X 3935(be)X 555 3104(used)N 722(in)X 804(recompiling)X 1211(and)X 1347(reinstalling)X 1727(the)X 1845(necessary)X 2178(programs.)X 755 3228(The)N 906(real)X 1053(work)X 1244(in)X 1332(setting)X 1571(up)X 1677(is)X 1756(to)X 1844(create)X 2063(the)X 2 f 2187(printcap)X 1 f 2497(\256le)X 2625(and)X 2767(any)X 2909(printer)X 3149(\256lters)X 3357(for)X 3476(printers)X 3746(not)X 3873(sup-)X 555 3324(ported)N 780(in)X 862(the)X 980(distribution)X 1368(system.)X 3 f 555 3516(4.1.)N 715(Creating)X 1038(a)X 1098(printcap)X 1411(\256le)X 1 f 755 3640(The)N 2 f 910(printcap)X 1 f 1224(database)X 1531(contains)X 1828(one)X 1974(or)X 2071(more)X 2266(entries)X 2510(per)X 2643(printer.)X 2927(A)X 3015(printer)X 3259(should)X 3501(have)X 3682(a)X 3747(separate)X 555 3736(spooling)N 852(directory;)X 1186(otherwise,)X 1540(jobs)X 1694(will)X 1839(be)X 1936(printed)X 2184(on)X 2285(different)X 2583(printers)X 2849(depending)X 3204(on)X 3305(which)X 3522(printer)X 3757(daemon)X 555 3832(starts)N 757(\256rst.)X 954(This)X 1129(section)X 1389(describes)X 1721(how)X 1892(to)X 1987(create)X 2213(entries)X 2459(for)X 2585(printers)X 2862(that)X 3014(do)X 3126(not)X 3260(conform)X 3564(to)X 3658(the)X 3788(default)X 555 3928(printer)N 789(description)X 1165(\(an)X 1288(LP-11)X 1508(style)X 1679(interface)X 1981(to)X 2063(a)X 2119(standard,)X 2431(band)X 2607(printer\).)X 3 f 555 4120(4.1.1.)N 775(Printers)X 1076(on)X 1180(serial)X 1387(lines)X 1 f 755 4244(When)N 974(a)X 1037(printer)X 1278(is)X 1358(connected)X 1711(via)X 1836(a)X 1899(serial)X 2100(communication)X 2625(line)X 2772(it)X 2843(must)X 3025(have)X 3204(the)X 3329(proper)X 3566(baud)X 3748(rate)X 3895(and)X 555 4340(terminal)N 853(modes)X 1093(set.)X 1253(The)X 1409(following)X 1751(example)X 2054(is)X 2138(for)X 2262(a)X 2328(DecWriter)X 2698(III)X 2809(printer)X 3053(connected)X 3409(locally)X 3657(via)X 3785(a)X 3851(1200)X 555 4436(baud)N 731(serial)X 925(line.)X 843 4580(lp)N 9 f 905(|)X 1 f (LA-180)S 1195(DecWriter)X 1555(III:\\)X 1043 4676(:lp=/dev/lp:br#1200:fs#06320:\\)N 1043 4772(:tr=\\f:of=/usr/lib/lpf:lf=/usr/adm/lpd-errs:)N 555 4916(The)N 3 f 711(lp)X 1 f 808(entry)X 1004(speci\256es)X 1311(the)X 1439(\256le)X 1571(name)X 1775(to)X 1867(open)X 2053(for)X 2177(output.)X 2431(Here)X 2618(it)X 2692(could)X 2900(be)X 3006(left)X 3143(out)X 3275(since)X 3470(``/dev/lp'')X 3830(is)X 3913(the)X 555 5012(default.)N 851(The)X 3 f 1009(br)X 1 f 1122(entry)X 1320(sets)X 1473(the)X 1604(baud)X 1793(rate)X 1947(for)X 2074(the)X 2205(tty)X 2322(line)X 2475(and)X 2624(the)X 3 f 2755(fs)X 1 f 2846(entry)X 3044(sets)X 3197(CRMOD,)X 3543(no)X 3656(parity,)X 3895(and)X 555 5108(XTABS)N 841(\(see)X 2 f 995(tty)X 1 f 1088(\(4\)\).)X 1273(The)X 3 f 1421(tr)X 1 f 1507(entry)X 1695(indicates)X 2003(that)X 2146(a)X 2205(form-feed)X 2550(should)X 2786(be)X 2885(printed)X 3135(when)X 3332(the)X 3453(queue)X 3668(empties)X 3940(so)X 555 5204(the)N 675(paper)X 876(can)X 1010(be)X 1108(torn)X 1259(off)X 1375(without)X 1641(turning)X 1894(the)X 2014(printer)X 2250(off-line)X 2513(and)X 2650(pressing)X 2938(form)X 3115(feed.)X 3315(The)X 3 f 3461(of)X 1 f 3549(entry)X 3735(speci\256es)X 555 5300(the)N 681(\256lter)X 860(program)X 2 f 1160(lpf)X 1 f 1285(should)X 1526(be)X 1630(used)X 1805(for)X 1927(printing)X 2208(the)X 2334(\256les;)X 2517(more)X 2710(will)X 2862(be)X 2966(said)X 3123(about)X 3329(\256lters)X 3538(later.)X 3748(The)X 3900(last)X 555 5396(entry)N 747(causes)X 984(errors)X 1199(to)X 1288(be)X 1391(written)X 1644(to)X 1732(the)X 1856(\256le)X 1984(``/usr/adm/lpd-errs'')X 2670(instead)X 2923(of)X 3016(the)X 3140(console.)X 3451(Most)X 3641(errors)X 3855(from)X 2 f 555 5492(lpd)N 1 f 681(are)X 804(logged)X 1046(using)X 2 f 1243(syslogd)X 1 f 1496(\(8\))X 1614(and)X 1754(will)X 1902(not)X 2028(be)X 2128(logged)X 2370(in)X 2456(the)X 2578(speci\256ed)X 2887(\256le.)X 3052(The)X 3200(\256lters)X 3405(should)X 3641(use)X 2 f 3771(syslogd)X 1 f 555 5588(to)N 641(report)X 857(errors;)X 1091(only)X 1257(those)X 1450(that)X 1594(write)X 1783(to)X 1869(standard)X 2165(error)X 2346(output)X 2574(will)X 2722(end)X 2862(up)X 2966(with)X 3132(errors)X 3344(in)X 3430(the)X 3 f 3552(lf)X 1 f 3625(\256le.)X 3791(\(Occa-)X 555 5684(sionally)N 834(errors)X 1048(sent)X 1203(to)X 1291(standard)X 1589(error)X 1772(output)X 2002(have)X 2180(not)X 2308(appeared)X 2625(in)X 2713(the)X 2837(log)X 2965(\256le;)X 3115(the)X 3239(use)X 3372(of)X 2 f 3464(syslogd)X 1 f 3729(is)X 3807(highly)X 555 5780(recommended.\))N

4 p %%Page: 4 4 10 s 0 xH 0 xS 1 f 555 384(SMM:6-4)N 2817(4.3BSD)X 3092(Line)X 3259(Printer)X 3497(Spooler)X 3766(Manual)X 3 f 555 672(4.1.2.)N 775(Remote)X 1059(printers)X 1 f 755 796(Printers)N 1038(that)X 1192(reside)X 1418(on)X 1532(remote)X 1789(hosts)X 1987(should)X 2234(have)X 2420(an)X 2530(empty)X 3 f 2763(lp)X 1 f 2862(entry.)X 3100(For)X 3244(example,)X 3569(the)X 3700(following)X 555 892(printcap)N 838(entry)X 1023(would)X 1243(send)X 1410(output)X 1634(to)X 1716(the)X 1834(printer)X 2068(named)X 2302(``lp'')X 2492(on)X 2592(the)X 2710(machine)X 3002(``ucbvax''.)X 843 1036(lp)N 9 f 905(|)X 1 f (default)S 1164(line)X 1304(printer:\\)X 1043 1132(:lp=:rm=ucbvax:rp=lp:sd=/usr/spool/vaxlpd:)N 555 1276(The)N 3 f 702(rm)X 1 f 827(entry)X 1014(is)X 1089(the)X 1209(name)X 1405(of)X 1494(the)X 1614(remote)X 1859(machine)X 2152(to)X 2235(connect)X 2506(to;)X 2611(this)X 2747(name)X 2942(must)X 3118(be)X 3215(a)X 3272(known)X 3511(host)X 3665(name)X 3860(for)X 3975(a)X 555 1372(machine)N 858(on)X 969(the)X 1098(network.)X 1432(The)X 3 f 1588(rp)X 1 f 1699(capability)X 2046(indicates)X 2362(the)X 2491(name)X 2696(of)X 2793(the)X 2921(printer)X 3165(on)X 3275(the)X 3403(remote)X 3656(machine)X 3958(is)X 555 1468(``lp'';)N 769(here)X 929(it)X 994(could)X 1193(be)X 1290(left)X 1418(out)X 1541(since)X 1727(this)X 1863(is)X 1937(the)X 2056(default)X 2300(value.)X 2535(The)X 3 f 2681(sd)X 1 f 2777(entry)X 2963(speci\256es)X 3260(``/usr/spool/vaxlpd'')X 3944(as)X 555 1564(the)N 673(spooling)X 968(directory)X 1278(instead)X 1525(of)X 1612(the)X 1730(default)X 1973(value)X 2167(of)X 2254(``/usr/spool/lpd''.)X 3 f 555 1756(4.2.)N 715(Output)X 983(\256lters)X 1 f 755 1880(Filters)N 985(are)X 1110(used)X 1283(to)X 1371(handle)X 1611(device)X 1847(dependencies)X 2306(and)X 2447(to)X 2534(do)X 2639(accounting)X 3016(functions.)X 3379(The)X 3529(output)X 3758(\256ltering)X 555 1976(of)N 3 f 646(of)X 1 f 737(is)X 814(used)X 984(when)X 1181(accounting)X 1556(is)X 1632(not)X 1757(being)X 1958(done)X 2137(or)X 2227(when)X 2424(all)X 2527(text)X 2670(data)X 2827(must)X 3005(be)X 3104(passed)X 3341(through)X 3613(a)X 3672(\256lter.)X 3886(It)X 3958(is)X 555 2072(not)N 679(intended)X 977(to)X 1061(do)X 1163(accounting)X 1537(since)X 1724(it)X 1790(is)X 1865(started)X 2101(only)X 2265(once,)X 2458(all)X 2559(text)X 2700(\256les)X 2854(are)X 2974(\256ltered)X 3222(through)X 3492(it,)X 3577(and)X 3714(no)X 3815(provi-)X 555 2168(sion)N 712(is)X 789(made)X 987(for)X 1105(passing)X 1369(owners')X 1652(login)X 1840(name,)X 2057(identifying)X 2431(the)X 2552(beginning)X 2895(and)X 3034(ending)X 3275(of)X 3365(jobs,)X 3541(etc.)X 3698(The)X 3846(other)X 555 2264(\256lters)N 762(\(if)X 862(speci\256ed\))X 1198(are)X 1321(started)X 1559(for)X 1677(each)X 1849(\256le)X 1975(printed)X 2226(and)X 2366(do)X 2470(accounting)X 2846(if)X 2919(there)X 3104(is)X 3181(an)X 3 f 3281(af)X 1 f 3372(entry.)X 3601(If)X 3679(entries)X 3917(for)X 555 2360(both)N 3 f 730(of)X 1 f 830(and)X 979(other)X 1177(\256lters)X 1392(are)X 1524(speci\256ed,)X 1861(the)X 1991(output)X 2227(\256lter)X 2410(is)X 2495(used)X 2674(only)X 2848(to)X 2942(print)X 3125(the)X 3255(banner)X 3506(page;)X 3712(it)X 3788(is)X 3873(then)X 555 2456(stopped)N 825(to)X 908(allow)X 1107(other)X 1293(\256lters)X 1496(access)X 1723(to)X 1806(the)X 1925(printer.)X 2200(An)X 2319(example)X 2612(of)X 2700(a)X 2757(printer)X 2992(that)X 3133(requires)X 3413(output)X 3638(\256lters)X 3840(is)X 3913(the)X 555 2552(Benson-Varian.)N 843 2696(va)N 9 f 919(|)X 1 f (varian)S 9 f 1136(|)X 1 f (Benson-Varian:\\)S 1043 2792(:lp=/dev/va0:sd=/usr/spool/vad:of=/usr/lib/vpf:\\)N 1043 2888(:tf=/usr/lib/rvcat:mx#2000:pl#58:px=2112:py=1700:tr=\\f:)N 555 3032(The)N 3 f 714(tf)X 1 f 802(entry)X 1001(speci\256es)X 1311(``/usr/lib/rvcat'')X 1862(as)X 1963(the)X 2095(\256lter)X 2280(to)X 2375(be)X 2484(used)X 2664(in)X 2759(printing)X 2 f 3045(troff)X 1 f 3195(\(1\))X 3322(output.)X 3599(This)X 3774(\256lter)X 3958(is)X 555 3128(needed)N 810(to)X 899(set)X 1015(the)X 1140(device)X 1377(into)X 1528(print)X 1706(mode)X 1911(for)X 2032(text,)X 2199(and)X 2342(plot)X 2493(mode)X 2698(for)X 2819(printing)X 2 f 3099(troff)X 1 f 3276(\256les)X 3436(and)X 3579(raster)X 3784(images)X 555 3224(\(see)N 2 f 706(va)X 1 f 795(\(4V\)\).)X 1035(Note)X 1212(that)X 1353(the)X 1472(page)X 1645(length)X 1866(is)X 1940(set)X 2050(to)X 2133(58)X 2234(lines)X 2406(by)X 2507(the)X 3 f 2626(pl)X 1 f 2713(entry)X 2899(for)X 3014(8.5")X 3168(by)X 3269(11")X 3403(fan-fold)X 3683(paper.)X 3922(To)X 555 3320(enable)N 785(accounting,)X 1177(the)X 1295(varian)X 1516(entry)X 1701(would)X 1921(be)X 2017(augmented)X 2389(with)X 2551(an)X 3 f 2647(af)X 1 f 2734(\256lter)X 2905(as)X 2992(shown)X 3221(below.)X 843 3464(va)N 9 f 919(|)X 1 f (varian)S 9 f 1136(|)X 1 f (Benson-Varian:\\)S 1043 3560(:lp=/dev/va0:sd=/usr/spool/vad:of=/usr/lib/vpf:\\)N 1043 3656(:if=/usr/lib/vpf:tf=/usr/lib/rvcat:af=/usr/adm/vaacct:\\)N 1043 3752(:mx#2000:pl#58:px=2112:py=1700:tr=\\f:)N 3 f 555 3992(4.3.)N 715(Access)X 963(Control)X 1 f 755 4116(Local)N 958(access)X 1184(to)X 1266(printer)X 1500(queues)X 1743(is)X 1816(controlled)X 2161(with)X 2323(the)X 3 f 2441(rg)X 1 f 2537(printcap)X 2820(entry.)X 1043 4260(:rg=lprgroup:)N 555 4404(Users)N 759(must)X 934(be)X 1030(in)X 1112(the)X 1230(group)X 2 f 1437(lprgroup)X 1 f 1754(to)X 1836(submit)X 2073(jobs)X 2226(to)X 2308(the)X 2426(speci\256ed)X 2731(printer.)X 3005(The)X 3150(default)X 3393(is)X 3466(to)X 3548(allow)X 3746(all)X 3846(users)X 555 4500(access.)N 825(Note)X 1005(that)X 1149(once)X 1325(the)X 1447(\256les)X 1604(are)X 1727(in)X 1813(the)X 1935(local)X 2115(queue,)X 2351(they)X 2513(can)X 2649(be)X 2749(printed)X 3000(locally)X 3241(or)X 3331(forwarded)X 3685(to)X 3770(another)X 555 4596(host)N 708(depending)X 1062(on)X 1162(the)X 1280(con\256guration.)X 755 4720(Remote)N 1025(access)X 1252(is)X 1326(controlled)X 1672(by)X 1773(listing)X 1993(the)X 2112(hosts)X 2297(in)X 2380(either)X 2584(the)X 2702(\256le)X 2824(/etc/hosts.equiv)X 3344(or)X 3431(/etc/hosts.lpd,)X 3895(one)X 555 4816(host)N 709(per)X 833(line.)X 994(Note)X 1171(that)X 2 f 1312(rsh)X 1 f 1414(\(1\))X 1529(and)X 2 f 1665(rlogin)X 1 f 1860(\(1\))X 1974(use)X 2101(/etc/hosts.equiv)X 2621(to)X 2703(determine)X 3044(which)X 3260(hosts)X 3444(are)X 3563(equivalent)X 3917(for)X 555 4912(allowing)N 867(logins)X 1094(without)X 1370(passwords.)X 1756(The)X 1912(\256le)X 2045(/etc/hosts.lpd)X 2500(is)X 2584(only)X 2757(used)X 2935(to)X 3028(control)X 3286(which)X 3513(hosts)X 3708(have)X 3891(line)X 555 5008(printer)N 798(access.)X 1073(Remote)X 1351(access)X 1586(can)X 1727(be)X 1832(further)X 2080(restricted)X 2408(to)X 2499(only)X 2670(allow)X 2877(remote)X 3129(users)X 3323(with)X 3494(accounts)X 3804(on)X 3913(the)X 555 5104(local)N 731(host)X 884(to)X 966(print)X 1137(jobs)X 1290(by)X 1390(using)X 1583(the)X 3 f 1701(rs)X 1 f 1788(printcap)X 2071(entry.)X 1043 5248(:rs:)N 3 f 555 5488(5.)N 655(Output)X 923(\256lter)X 1108(speci\256cations)X 1 f 755 5612(The)N 904(\256lters)X 1110(supplied)X 1405(with)X 1571(4.3BSD)X 1850(handle)X 2088(printing)X 2365(and)X 2505(accounting)X 2881(for)X 2999(most)X 3178(common)X 3482(line)X 3625(printers,)X 3913(the)X 555 5708(Benson-Varian,)N 1085(the)X 1207(wide)X 1387(\(36"\))X 1578(and)X 1718(narrow)X 1969(\(11"\))X 2159(Versatec)X 2464(printer/plotters.)X 2983(For)X 3117(other)X 3305(devices)X 3569(or)X 3659(accounting)X 555 5804(methods,)N 866(it)X 930(may)X 1088(be)X 1184(necessary)X 1517(to)X 1599(create)X 1812(a)X 1868(new)X 2022(\256lter.)X

5 p %%Page: 5 5 10 s 0 xH 0 xS 1 f 555 384(4.3BSD)N 830(Line)X 997(Printer)X 1235(Spooler)X 1504(Manual)X 3696(SMM:6-5)X 755 672(Filters)N 986(are)X 1112(spawned)X 1420(by)X 2 f 1527(lpd)X 1 f 1656(with)X 1825(their)X 1999(standard)X 2298(input)X 2489(the)X 2614(data)X 2775(to)X 2864(be)X 2967(printed,)X 3241(and)X 3384(standard)X 3683(output)X 3913(the)X 555 768(printer.)N 835(The)X 986(standard)X 1284(error)X 1467(is)X 1546(attached)X 1840(to)X 1928(the)X 3 f 2052(lf)X 1 f 2127(\256le)X 2254(for)X 2373(logging)X 2642(errors)X 2855(or)X 2 f 2947(syslogd)X 1 f 3212(may)X 3375(be)X 3476(used)X 3648(for)X 3767(logging)X 555 864(errors.)N 809(A)X 892(\256lter)X 1068(must)X 1248(return)X 1465(a)X 1526(0)X 1591(exit)X 1736(code)X 1913(if)X 1987(there)X 2173(were)X 2355(no)X 2460(errors,)X 2693(1)X 2758(if)X 2832(the)X 2955(job)X 3082(should)X 3320(be)X 3421(reprinted,)X 3756(and)X 3897(2)X 3962(if)X 555 960(the)N 682(job)X 812(should)X 1053(be)X 1157(thrown)X 1412(away.)X 1650(When)X 2 f 1870(lprm)X 1 f 2049(sends)X 2255(a)X 2319(kill)X 2453(signal)X 2672(to)X 2762(the)X 2 f 2888(lpd)X 1 f 3018(process)X 3287(controlling)X 3666(printing,)X 3967(it)X 555 1056(sends)N 763(a)X 829(SIGINT)X 1122(signal)X 1343(to)X 1435(all)X 1544(\256lters)X 1755(and)X 1900(descendents)X 2317(of)X 2413(\256lters.)X 2664(This)X 2835(signal)X 3055(can)X 3196(be)X 3301(trapped)X 3571(by)X 3680(\256lters)X 3891(that)X 555 1152(need)N 727(to)X 809(do)X 909(cleanup)X 1179(operations)X 1533(such)X 1700(as)X 1787(deleting)X 2065(temporary)X 2415(\256les.)X 755 1276(Arguments)N 1131(passed)X 1365(to)X 1447(a)X 1503(\256lter)X 1674(depend)X 1926(on)X 2026(its)X 2121(type.)X 2319(The)X 3 f 2464(of)X 1 f 2551(\256lter)X 2722(is)X 2795(called)X 3007(with)X 3169(the)X 3287(following)X 3618(arguments.)X 2 f 843 1420(\256lter)N 3 f 9 f 1014(-)X 3 f 1058(w)X 1 f 1116(width)X 3 f 9 f 1318(-)X 3 f 1362(l)X 1 f 1384(length)X 555 1564(The)N 2 f 711(width)X 1 f 919(and)X 2 f 1066(length)X 1 f 1297(values)X 1533(come)X 1738(from)X 1925(the)X 3 f 2054(pw)X 1 f 2187(and)X 3 f 2334(pl)X 1 f 2431(entries)X 2676(in)X 2769(the)X 2898(printcap)X 3192(database.)X 3540(The)X 3 f 3696(if)X 1 f 3776(\256lter)X 3958(is)X 555 1660(passed)N 789(the)X 907(following)X 1238(parameters.)X 2 f 843 1804(\256lter)N 1 f 1014([)X 3 f 9 f 1054(-)X 3 f 1098(c)X 1 f 1147(])X 3 f 9 f 1194(-)X 3 f 1238(w)X 1 f 1296(width)X 3 f 9 f 1498(-)X 3 f 1542(l)X 1 f 1564(length)X 3 f 9 f 1784(-)X 3 f 1828(i)X 1 f 1850(indent)X 3 f 9 f 2070(-)X 3 f 2114(n)X 1 f 2178(login)X 3 f 9 f 2362(-)X 3 f 2406(h)X 1 f 2470(host)X 2623(accounting_\256le)X 555 1948(The)N 3 f 9 f 710(-)X 3 f 754(c)X 1 f 820(\257ag)X 970(is)X 1053(optional,)X 1365(and)X 1511(only)X 1683(supplied)X 1983(when)X 2186(control)X 2442(characters)X 2798(are)X 2926(to)X 3017(be)X 3122(passed)X 3365(uninterpreted)X 3822(to)X 3913(the)X 555 2044(printer)N 791(\(when)X 1014(using)X 1208(the)X 3 f 9 f 1327(-)X 3 f 1371(l)X 1 f 1414(option)X 1639(of)X 2 f 1727(lpr)X 1 f 1854(to)X 1937(print)X 2109(the)X 2228(\256le\).)X 2418(The)X 3 f 9 f 2564(-)X 3 f 2608(w)X 1 f 2687(and)X 3 f 9 f 2824(-)X 3 f 2868(l)X 1 f 2911(parameters)X 3285(are)X 3405(the)X 3524(same)X 3710(as)X 3798(for)X 3913(the)X 3 f 555 2140(of)N 1 f 644(\256lter.)X 857(The)X 3 f 9 f 1004(-)X 3 f 1048(n)X 1 f 1113(and)X 3 f 9 f 1250(-)X 3 f 1294(h)X 1 f 1359(parameters)X 1733(specify)X 1986(the)X 2105(login)X 2290(name)X 2485(and)X 2622(host)X 2776(name)X 2971(of)X 3059(the)X 3178(job)X 3301(owner.)X 3563(The)X 3709(last)X 3841(argu-)X 555 2236(ment)N 735(is)X 808(the)X 926(name)X 1120(of)X 1207(the)X 1325(accounting)X 1697(\256le)X 1819(from)X 2 f 1995(printcap)X 1 f 2266(.)X 755 2360(All)N 877(other)X 1062(\256lters)X 1264(are)X 1383(called)X 1595(with)X 1757(the)X 1875(following)X 2206(arguments:)X 2 f 843 2504(\256lter)N 3 f 9 f 1014(-)X 3 f 1058(x)X 1 f (width)S 3 f 9 f 1300(-)X 3 f 1344(y)X 1 f (length)S 3 f 9 f 1604(-)X 3 f 1648(n)X 1 f 1712(login)X 3 f 9 f 1896(-)X 3 f 1940(h)X 1 f 2004(host)X 2157(accounting_\256le)X 555 2648(The)N 3 f 9 f 702(-)X 3 f 746(x)X 1 f 808(and)X 3 f 9 f 946(-)X 3 f 990(y)X 1 f 1052(options)X 1309(specify)X 1563(the)X 1683(horizontal)X 2030(and)X 2168(vertical)X 2430(page)X 2603(size)X 2749(in)X 2832(pixels)X 3044(\(from)X 3248(the)X 3 f 3367(px)X 1 f 3472(and)X 3 f 3609(py)X 1 f 3714(entries)X 3949(in)X 555 2744(the)N 673(printcap)X 956(\256le\).)X 1145(The)X 1290(rest)X 1426(of)X 1513(the)X 1631(arguments)X 1985(are)X 2104(the)X 2222(same)X 2407(as)X 2494(for)X 2608(the)X 3 f 2726(if)X 1 f 2795(\256lter.)X 3 f 555 2936(6.)N 655(Line)X 830(printer)X 1095(Administration)X 1 f 755 3060(The)N 2 f 910(lpc)X 1 f 1051(program)X 1353(provides)X 1659(local)X 1844(control)X 2100(over)X 2272(line)X 2421(printer)X 2664(activity.)X 2973(The)X 3127(major)X 3343(commands)X 3719(and)X 3864(their)X 555 3156(intended)N 851(use)X 978(will)X 1122(be)X 1218(described.)X 1586(The)X 1731(command)X 2067(format)X 2301(and)X 2437(remaining)X 2782(commands)X 3149(are)X 3268(described)X 3596(in)X 2 f 3678(lpc)X 1 f 3776(\(8\).)X 3 f 555 3280(abort)N 1 f 762(and)X 3 f 898(start)X 2 f 755 3404(Abort)N 1 f 972(terminates)X 1328(an)X 1426(active)X 1640(spooling)X 1936(daemon)X 2211(on)X 2312(the)X 2431(local)X 2608(host)X 2762(immediately)X 3183(and)X 3320(then)X 3479(disables)X 3758(printing)X 755 3500(\(preventing)N 1146(new)X 1301(daemons)X 1607(from)X 1784(being)X 1983(started)X 2218(by)X 2 f 2319(lpr)X 1 f 2412(\).)X 2500(This)X 2663(is)X 2737(normally)X 3047(used)X 3215(to)X 3298(forcibly)X 3573(restart)X 3795(a)X 3851(hung)X 755 3596(line)N 896(printer)X 1131(daemon)X 1406(\(i.e.,)X 2 f 1572(lpq)X 1 f 1695(reports)X 1939(that)X 2079(there)X 2260(is)X 2333(a)X 2389(daemon)X 2663(present)X 2915(but)X 3037(nothing)X 3301(is)X 3374(happening\).)X 3795(It)X 3864(does)X 755 3692(not)N 887(remove)X 1158(any)X 1304(jobs)X 1467(from)X 1653(the)X 1781(queue)X 2003(\(use)X 2167(the)X 2 f 2295(lprm)X 1 f 2476(command)X 2822(instead\).)X 2 f 3146(Start)X 1 f 3343(enables)X 3613(printing)X 3895(and)X 755 3788(requests)N 2 f 1038(lpd)X 1 f 1160(to)X 1242(start)X 1400(printing)X 1673(jobs.)X 3 f 555 3912(enable)N 1 f 797(and)X 3 f 933(disable)X 2 f 755 4036(Enable)N 1 f 1003(and)X 2 f 1140(disable)X 1 f 1392(allow)X 1591(spooling)X 1887(in)X 1970(the)X 2089(local)X 2266(queue)X 2479(to)X 2561(be)X 2657(turned)X 2882(on/off.)X 3138(This)X 3300(will)X 3444(allow/prevent)X 2 f 3905(lpr)X 1 f 755 4132(from)N 934(putting)X 1183(new)X 1340(jobs)X 1496(in)X 1581(the)X 1702(spool)X 1898(queue.)X 2153(It)X 2224(is)X 2299(frequently)X 2651(convenient)X 3025(to)X 3109(turn)X 3260(spooling)X 3557(off)X 3673(while)X 3873(test-)X 755 4228(ing)N 878(new)X 1033(line)X 1174(printer)X 1409(\256lters)X 1612(since)X 1797(the)X 2 f 1915(root)X 1 f 2081(user)X 2235(can)X 2367(still)X 2506(use)X 2 f 2633(lpr)X 1 f 2759(to)X 2841(put)X 2963(jobs)X 3116(in)X 3198(the)X 3316(queue)X 3528(but)X 3650(no)X 3750(one)X 3886(else)X 755 4324(can.)N 942(The)X 1102(other)X 1302(main)X 1497(use)X 1639(is)X 1727(to)X 1824(prevent)X 2100(users)X 2299(from)X 2489(putting)X 2749(jobs)X 2916(in)X 3012(the)X 3144(queue)X 3370(when)X 3578(the)X 3710(printer)X 3958(is)X 755 4420(expected)N 1061(to)X 1143(be)X 1239(unavailable)X 1629(for)X 1743(a)X 1799(long)X 1961(time.)X 3 f 555 4544(restart)N 2 f 755 4668(Restart)N 1 f 1028(allows)X 1266(ordinary)X 1567(users)X 1761(to)X 1851(restart)X 2080(printer)X 2322(daemons)X 2635(when)X 2 f 2837(lpq)X 1 f 2980(reports)X 3231(that)X 3379(there)X 3568(is)X 3649(no)X 3757(daemon)X 755 4764(present.)N 3 f 555 4888(stop)N 2 f 755 5012(Stop)N 1 f 938(halts)X 1117(a)X 1181(spooling)X 1484(daemon)X 1765(after)X 1940(the)X 2065(current)X 2320(job)X 2449(completes;)X 2823(this)X 2965(also)X 3121(disables)X 3406(printing.)X 3726(This)X 3895(is)X 3975(a)X 755 5108(clean)N 946(way)X 1101(to)X 1184(shutdown)X 1516(a)X 1573(printer)X 1808(to)X 1891(do)X 1992(maintenance,)X 2439(etc.)X 2594(Note)X 2770(that)X 2910(users)X 3095(can)X 3227(still)X 3366(enter)X 3547(jobs)X 3700(in)X 3782(a)X 3838(spool)X 755 5204(queue)N 967(while)X 1165(a)X 1221(printer)X 1455(is)X 2 f 1528(stopped)X 1 f 1777(.)X 3 f 555 5328(topq)N 2 f 755 5452(Topq)N 1 f 958(places)X 1185(jobs)X 1344(at)X 1428(the)X 1552(top)X 1680(of)X 1773(a)X 1835(printer)X 2075(queue.)X 2333(This)X 2501(can)X 2638(be)X 2739(used)X 2911(to)X 2998(reorder)X 3256(high)X 3423(priority)X 3688(jobs)X 3846(since)X 2 f 755 5548(lpr)N 1 f 881(only)X 1043(provides)X 1339(\256rst-come-\256rst-serve)X 2032(ordering)X 2324(of)X 2411(jobs.)X

6 p %%Page: 6 6 10 s 0 xH 0 xS 1 f 555 384(SMM:6-6)N 2817(4.3BSD)X 3092(Line)X 3259(Printer)X 3497(Spooler)X 3766(Manual)X 3 f 555 672(7.)N 655(Troubleshooting)X 1 f 755 796(There)N 980(are)X 1116(several)X 1381(messages)X 1721(that)X 1878(may)X 2053(be)X 2166(generated)X 2516(by)X 2633(the)X 2768(the)X 2902(line)X 3058(printer)X 3308(system.)X 3606(This)X 3784(section)X 555 892(categorizes)N 946(the)X 1073(most)X 1257(common)X 1566(and)X 1711(explains)X 2006(the)X 2132(cause)X 2339(for)X 2461(their)X 2636(generation.)X 3043(Where)X 3286(the)X 3412(message)X 3712(implies)X 3975(a)X 555 988(failure,)N 805(directions)X 1141(are)X 1260(given)X 1458(to)X 1540(remedy)X 1801(the)X 1919(problem.)X 755 1112(In)N 842(the)X 960(examples)X 1283(below,)X 1519(the)X 1637(name)X 2 f 1831(printer)X 1 f 2086(is)X 2159(the)X 2277(name)X 2471(of)X 2558(the)X 2676(printer)X 2910(from)X 3086(the)X 2 f 3204(printcap)X 1 f 3508(database.)X 3 f 555 1304(7.1.)N 715(LPR)X 555 1496(lpr:)N 2 f 704(printer)X 3 f 939(:)X 986(unknown)X 1324(printer)X 1 f 755 1620(The)N 2 f 909(printer)X 1 f 1173(was)X 1327(not)X 1458(found)X 1673(in)X 1763(the)X 2 f 1889(printcap)X 1 f 2201(database.)X 2546(Usually)X 2823(this)X 2966(is)X 3047(a)X 3111(typing)X 3343(mistake;)X 3642(however,)X 3967(it)X 755 1716(may)N 913(indicate)X 1187(a)X 1243(missing)X 1511(or)X 1598(incorrect)X 1904(entry)X 2089(in)X 2171(the)X 2289(/etc/printcap)X 2710(\256le.)X 3 f 555 1908(lpr:)N 2 f 704(printer)X 3 f 939(:)X 986(jobs)X 1148(queued,)X 1436(but)X 1571(cannot)X 1822(start)X 2003(daemon.)X 1 f 755 2032(The)N 908(connection)X 1288(to)X 2 f 1377(lpd)X 1 f 1519(on)X 1626(the)X 1751(local)X 1934(machine)X 2233(failed.)X 2463(This)X 2632(usually)X 2890(means)X 3122(the)X 3247(printer)X 3488(server)X 3712(started)X 3953(at)X 755 2128(boot)N 922(time)X 1089(has)X 1221(died)X 1384(or)X 1476(is)X 1553(hung.)X 1777(Check)X 2006(the)X 2128(local)X 2308(socket)X 2537(/dev/printer)X 2935(to)X 3021(be)X 3121(sure)X 3279(it)X 3347(still)X 3490(exists)X 3696(\(if)X 3796(it)X 3864(does)X 755 2224(not)N 878(exist,)X 1070(there)X 1252(is)X 1326(no)X 2 f 1427(lpd)X 1 f 1563(process)X 1825(running\).)X 2142(Usually)X 2412(it)X 2477(is)X 2550(enough)X 2806(to)X 2888(get)X 3006(a)X 3062(super-user)X 3417(to)X 3499(type)X 3657(the)X 3775(follow-)X 755 2320(ing)N 877(to)X 959(restart)X 2 f 1180(lpd)X 1 f 1282(.)X 1043 2464(%)N 1130(/usr/lib/lpd)X 755 2608(You)N 913(can)X 1045(also)X 1194(check)X 1402(the)X 1520(state)X 1687(of)X 1774(the)X 1892(master)X 2126(printer)X 2360(daemon)X 2634(with)X 2796(the)X 2914(following.)X 1043 2752(%)N 1130(ps)X 1221(l`cat)X 1384(/usr/spool/lpd.lock`)X 755 2924(Another)N 1044(possibility)X 1402(is)X 1481(that)X 1627(the)X 2 f 1751(lpr)X 1 f 1883(program)X 2181(is)X 2260(not)X 2388(set-user-id)X 2753(to)X 2 f 2841(root)X 1 f 2974(,)X 3020(set-group-id)X 3438(to)X 3525(group)X 2 f 3737(daemon)X 1 f 3991(.)X 755 3020(This)N 917(can)X 1049(be)X 1145(checked)X 1429(with)X 1043 3164(%)N 1130(ls)X 9 f 1203(-)X 1 f 1247(lg)X 1329(/usr/ucb/lpr)X 3 f 555 3404(lpr:)N 2 f 704(printer)X 3 f 939(:)X 986(printer)X 1251(queue)X 1475(is)X 1548(disabled)X 1 f 755 3528(This)N 917(means)X 1142(the)X 1260(queue)X 1472(was)X 1617(turned)X 1842(off)X 1956(with)X 1043 3672(%)N 1130(lpc)X 1248(disable)X 2 f 1495(printer)X 1 f 755 3816(to)N 840(prevent)X 2 f 1104(lpr)X 1 f 1233(from)X 1412(putting)X 1661(\256les)X 1817(in)X 1902(the)X 2023(queue.)X 2278(This)X 2443(is)X 2519(normally)X 2831(done)X 3010(by)X 3113(the)X 3234(system)X 3479(manager)X 3779(when)X 3975(a)X 755 3912(printer)N 993(is)X 1070(going)X 1276(to)X 1362(be)X 1462(down)X 1664(for)X 1782(a)X 1842(long)X 2008(time.)X 2214(The)X 2363(printer)X 2601(can)X 2737(be)X 2837(turned)X 3066(back)X 3242(on)X 3346(by)X 3450(a)X 3510(super-user)X 3869(with)X 2 f 755 4008(lpc)N 1 f 853(.)X 3 f 555 4200(7.2.)N 715(LPQ)X 555 4392(waiting)N 828(for)X 2 f 951(printer)X 3 f 1193(to)X 1280(become)X 1559(ready)X 1775(\(of\257ine)X 2035(?\))X 1 f 755 4516(The)N 901(printer)X 1136(device)X 1367(could)X 1566(not)X 1689(be)X 1785(opened)X 2037(by)X 2137(the)X 2255(daemon.)X 2549(This)X 2711(can)X 2843(happen)X 3095(for)X 3209(several)X 3457(reasons,)X 3738(the)X 3856(most)X 755 4612(common)N 1057(is)X 1132(that)X 1274(the)X 1394(printer)X 1630(is)X 1705(turned)X 1932(off-line.)X 2235(This)X 2399(message)X 2693(can)X 2827(also)X 2978(be)X 3076(generated)X 3411(if)X 3481(the)X 3600(printer)X 3835(is)X 3909(out)X 755 4708(of)N 851(paper,)X 1078(the)X 1204(paper)X 1411(is)X 1492(jammed,)X 1798(etc.)X 1960(The)X 2113(actual)X 2333(reason)X 2571(is)X 2652(dependent)X 3010(on)X 3118(the)X 3244(meaning)X 3548(of)X 3643(error)X 3828(codes)X 755 4804(returned)N 1050(by)X 1157(system)X 1406(device)X 1643(driver.)X 1882(Not)X 2029(all)X 2135(printers)X 2406(supply)X 2645(enough)X 2907(information)X 3311(to)X 3399(distinguish)X 3775(when)X 3975(a)X 755 4900(printer)N 994(is)X 1072(off-line)X 1338(or)X 1430(having)X 1673(trouble)X 1925(\(e.g.)X 2092(a)X 2152(printer)X 2390(connected)X 2740(through)X 3013(a)X 3073(serial)X 3271(line\).)X 3462(Another)X 3749(possible)X 755 4996(cause)N 962(of)X 1057(this)X 1200(message)X 1500(is)X 1580(some)X 1776(other)X 1968(process,)X 2256(such)X 2430(as)X 2524(an)X 2627(output)X 2858(\256lter,)X 3056(has)X 3190(an)X 3293(exclusive)X 3623(open)X 3806(on)X 3913(the)X 755 5092(device.)N 1033(Your)X 1226(only)X 1395(recourse)X 1695(here)X 1861(is)X 1941(to)X 2030(kill)X 2163(off)X 2284(the)X 2409(offending)X 2748(program\(s\))X 3132(and)X 3275(restart)X 3503(the)X 3628(printer)X 3869(with)X 2 f 755 5188(lpc)N 1 f 853(.)X 2 f 555 5380(printer)N 3 f 797(is)X 870(ready)X 1086(and)X 1234(printing)X 1 f 755 5504(The)N 2 f 915(lpq)X 1 f 1065(program)X 1372(checks)X 1626(to)X 1723(see)X 1861(if)X 1945(a)X 2015(daemon)X 2303(process)X 2578(exists)X 2794(for)X 2 f 2922(printer)X 1 f 3191(and)X 3341(prints)X 3557(the)X 3689(\256le)X 2 f 3825(status)X 1 f 755 5600(located)N 1008(in)X 1091(the)X 1210(spooling)X 1506(directory.)X 1857(If)X 1932(the)X 2051(daemon)X 2326(is)X 2400(hung,)X 2601(a)X 2658(super)X 2853(user)X 3008(can)X 3140(use)X 2 f 3267(lpc)X 1 f 3398(to)X 3480(abort)X 3665(the)X 3783(current)X 755 5696(daemon)N 1029(and)X 1165(start)X 1323(a)X 1379(new)X 1533(one.)X

7 p %%Page: 7 7 10 s 0 xH 0 xS 1 f 555 384(4.3BSD)N 830(Line)X 997(Printer)X 1235(Spooler)X 1504(Manual)X 3696(SMM:6-7)X 3 f 555 672(waiting)N 828(for)X 2 f 951(host)X 3 f 1104(to)X 1191(come)X 1390(up)X 1 f 755 796(This)N 921(implies)X 1180(there)X 1365(is)X 1441(a)X 1500(daemon)X 1777(trying)X 1991(to)X 2076(connect)X 2349(to)X 2434(the)X 2555(remote)X 2801(machine)X 3096(named)X 2 f 3333(host)X 1 f 3502(to)X 3587(send)X 3757(the)X 3878(\256les)X 755 892(in)N 840(the)X 961(local)X 1140(queue.)X 1375(If)X 1452(the)X 1572(remote)X 1817(machine)X 2111(is)X 2186(up,)X 2 f 2308(lpd)X 1 f 2445(on)X 2547(the)X 2667(remote)X 2912(machine)X 3206(is)X 3281(probably)X 3588(dead)X 3762(or)X 3851(hung)X 755 988(and)N 891(should)X 1124(be)X 1220(restarted)X 1517(as)X 1604(mentioned)X 1962(for)X 2 f 2076(lpr)X 1 f 2169(.)X 3 f 555 1180(sending)N 836(to)X 2 f 923(host)X 1 f 755 1304(The)N 907(\256les)X 1067(should)X 1307(be)X 1410(in)X 1499(the)X 1624(process)X 1891(of)X 1984(being)X 2188(transferred)X 2563(to)X 2651(the)X 2775(remote)X 2 f 3024(host)X 1 f 3157(.)X 3223(If)X 3303(not,)X 3451(the)X 3575(local)X 3757(daemon)X 755 1400(should)N 988(be)X 1084(aborted)X 1345(and)X 1481(started)X 1715(with)X 2 f 1877(lpc)X 1 f 1975(.)X 3 f 555 1592(Warning:)N 2 f 908(printer)X 3 f 1150(is)X 1223(down)X 1 f 755 1716(The)N 900(printer)X 1134(has)X 1261(been)X 1433(marked)X 1694(as)X 1781(being)X 1979(unavailable)X 2369(with)X 2 f 2531(lpc)X 1 f 2629(.)X 3 f 555 1908(Warning:)N 908(no)X 1012(daemon)X 1303(present)X 1 f 755 2032(The)N 2 f 903(lpd)X 1 f 1028(process)X 1292(overseeing)X 1663(the)X 1783(spooling)X 2080(queue,)X 2314(as)X 2403(speci\256ed)X 2710(in)X 2794(the)X 2914(``lock'')X 3182(\256le)X 3306(in)X 3390(that)X 3532(directory,)X 3864(does)X 755 2128(not)N 880(exist.)X 1094(This)X 1259(normally)X 1571(occurs)X 1804(only)X 1969(when)X 2166(the)X 2287(daemon)X 2564(has)X 2693(unexpectedly)X 3143(died.)X 3343(The)X 3490(error)X 3669(log)X 3793(\256le)X 3917(for)X 755 2224(the)N 880(printer)X 1121(and)X 1264(the)X 2 f 1389(syslogd)X 1 f 1656(logs)X 1816(should)X 2056(be)X 2159(checked)X 2450(for)X 2571(a)X 2634(diagnostic)X 2990(from)X 3173(the)X 3298(deceased)X 3615(process.)X 3922(To)X 755 2320(restart)N 976(an)X 2 f 1072(lpd)X 1 f 1174(,)X 1214(use)X 1043 2464(%)N 1130(lpc)X 1248(restart)X 2 f 1469(printer)X 3 f 555 2704(no)N 659(space)X 866(on)X 970(remote;)X 1259(waiting)X 1532(for)X 1655(queue)X 1879(to)X 1966(drain)X 1 f 755 2828(This)N 921(implies)X 1180(that)X 1324(there)X 1509(is)X 1586(insuf\256cient)X 1970(disk)X 2127(space)X 2330(on)X 2434(the)X 2555(remote.)X 2841(If)X 2918(the)X 3039(\256le)X 3164(is)X 3240(large)X 3424(enough,)X 3703(there)X 3887(will)X 755 2924(never)N 963(be)X 1068(enough)X 1333(space)X 1541(on)X 1650(the)X 1777(remote)X 2029(\(even)X 2237(after)X 2414(the)X 2540(queue)X 2760(on)X 2868(the)X 2994(remote)X 3245(is)X 3326(empty\).)X 3601(The)X 3754(solution)X 755 3020(here)N 914(is)X 987(to)X 1069(move)X 1267(the)X 1385(spooling)X 1680(queue)X 1892(or)X 1979(make)X 2173(more)X 2358(free)X 2504(space)X 2703(on)X 2803(the)X 2921(remote.)X 3 f 555 3212(7.3.)N 715(LPRM)X 555 3404(lprm:)N 2 f 771(printer)X 3 f 1006(:)X 1053(cannot)X 1304(restart)X 1557(printer)X 1822(daemon)X 1 f 755 3528(This)N 917(case)X 1076(is)X 1149(the)X 1267(same)X 1452(as)X 1539(when)X 2 f 1733(lpr)X 1 f 1859(prints)X 2061(that)X 2201(the)X 2319(daemon)X 2593(cannot)X 2827(be)X 2923(started.)X 3 f 555 3720(7.4.)N 715(LPD)X 1 f 755 3844(The)N 2 f 910(lpd)X 1 f 1055(program)X 1357(can)X 1499(log)X 1631(many)X 1839(different)X 2146(messages)X 2479(using)X 2 f 2681(syslogd)X 1 f 2934(\(8\).)X 3097(Most)X 3290(of)X 3386(these)X 3580(messages)X 3912(are)X 555 3940(about)N 760(\256les)X 920(that)X 1067(can)X 1206(not)X 1335(be)X 1438(opened)X 1697(and)X 1840(usually)X 2097(imply)X 2309(that)X 2455(the)X 2 f 2579(printcap)X 1 f 2889(\256le)X 3017(or)X 3110(the)X 3234(protection)X 3585(modes)X 3820(of)X 3913(the)X 555 4036(\256les)N 717(are)X 844(incorrect.)X 1218(Files)X 1401(may)X 1567(also)X 1724(be)X 1828(inaccessible)X 2244(if)X 2321(people)X 2563(manually)X 2889(manipulate)X 3273(the)X 3399(line)X 3547(printer)X 3789(system)X 555 4132(\(i.e.)N 700(they)X 858(bypass)X 1096(the)X 2 f 1214(lpr)X 1 f 1340(program\).)X 755 4256(In)N 846(addition)X 1132(to)X 1218(messages)X 1545(generated)X 1882(by)X 2 f 1986(lpd)X 1 f 2088(,)X 2131(any)X 2270(of)X 2360(the)X 2481(\256lters)X 2686(that)X 2 f 2829(lpd)X 1 f 2967(spawns)X 3226(may)X 3387(log)X 3512(messages)X 3838(using)X 2 f 555 4352(syslogd)N 1 f 815(or)X 902(to)X 984(the)X 1102(error)X 1279(log)X 1401(\256le)X 1523(\(the)X 1668(\256le)X 1790(speci\256ed)X 2095(in)X 2177(the)X 3 f 2295(lf)X 1 f 2364(entry)X 2549(in)X 2 f 2631(printcap)X 1 f 2915(\).)X 3 f 555 4544(7.5.)N 715(LPC)X 555 4764(couldn't)N 859(start)X 1040(printer)X 1 f 755 4888(This)N 917(case)X 1076(is)X 1149(the)X 1267(same)X 1452(as)X 1539(when)X 2 f 1733(lpr)X 1 f 1859(reports)X 2102(that)X 2242(the)X 2360(daemon)X 2634(cannot)X 2868(be)X 2964(started.)X 3 f 555 5080(cannot)N 806(examine)X 1111(spool)X 1308(directory)X 1 f 755 5204(Error)N 947(messages)X 1272(beginning)X 1613(with)X 1776(``cannot)X 2065(...'')X 2200(are)X 2320(usually)X 2572(because)X 2848(of)X 2936(incorrect)X 3243(ownership)X 3598(or)X 3686(protection)X 755 5300(mode)N 953(of)X 1040(the)X 1158(lock)X 1316(\256le,)X 1458(spooling)X 1753(directory)X 2063(or)X 2150(the)X 2 f 2268(lpc)X 1 f 2399(program.)X

7 p %%Trailer xt


This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:10:28 CDT