apsfilter installs itself as the input filter for
any printer it manages, and looks at the source file. It decides
based on a number of pieces of information what kind of source file
it is, automatically processes it with the right set of programs, and
poof, you have correct output coming out of your printer.
There's a reason this kind of tool is called a
"magic filter" (and why the title
of this chapter says
"Automagically"). Having a magic
filter installed makes life so much easier.
If you look at your printcap once apsfilter is
installed, you'll notice this entry (or something
much like it):
lp|local line printer:\
...
:if=/usr/local/sbin/apsfilter:\
...
That's all it takes to hook into
lpd and tell the spooler to give
apsfilter a shot at the text on the way through.
apsfilter looks at the incoming file and its
configuration for the printer queue and converts the source into the
appropriate printer language using whatever filter or set of filters
are needed.