is an extensible and customizable automatic printer filter. It
selects an appropriate conversion technique for the input data by
and then utilizing the appropriate conversion utility.
is primarily intended for use as the ``input filter'' by the
print spooler. The options accepted by
are exactly the ones passed to the input filter by
will be invoked by
and hence provided the right options automatically. This list is
included for reference only.
Note that only the
options may have spaces between the option letter and the option value.
Copy the input to the output without any conversion whatsoever (used
option is passed to the
-nuser, -n user
The login name of the user who submitted the job. Available to
If the user has an associated GECOS entry it will be available as
-hhost, -h host
The host on which the job was submitted. Available to subfilters as
A numeric option passed by
can be set by the user by the
Although nominally used for the amount of indentation requested,
makes it available to subfilters for any useful purpose as
LPRng class (priority) name. Available to subfilters as
Format letter (passed by LPRng only). When used as input filter (if)
this will be
when used as other filter types it will be the option character
corresponding to this filter. Available to subfilters as
The name of the printer job (passed by LPRng only). Available to
Copy count (passed by LPRng only). Available to subfilters as
User name from the banner page (passed by LPRng only). Available to
Printer name (passed by LPRng only). Available to subfilters as
Spool queue name (passed by LPRng only). Available to subfilters as
Accounting information (passed by LPRng only). Available to
LPRng ``Z-options''. The LPRng
program supports a
option, which can be used to pass arbitrary information to the printer
filters. Available to subfilters as
Write the name of each facility invoked (together with any options) to
standard error. This can be useful for debugging complicated
Any other options, such as the
options typically passed by
RUNNING MAGICFILTER FROM LPD
it should be entered as one of the filters in the
file. Typically, it will be the input filter (if). Since most
do not accept arguments entered as part of the filter name, typically
the filter name entered into the
file will simply be the name of the configuration file, which is set
executable and starts with the line:
Most UNIX kernels will then be able to treat the configuration file
itself as if it was the actual program.
For systems which do not support the ``#!-hack'', the filter set in
the if entry should point to
directly, and the accounting file (af) entry should point to the
configuration file. This, however, is a less general, and hence less
This version of
supports the enhanced
included with the LPRng package from
THE CONFIGURATION FILE
The configuration file is used by
to redirect various types of data to the various conversion utilities.
The configuration file is printer-specific, and often system-specific,
depending on the available conversion programs. For example, a system
which has GhostScript installed would be able to print PostScript to a
non-PostScript printer, whereas other systems typically would not.
The configuration file contains a sequence of lines of the form:
where the offset
represents the location of the indentification string in the data
represents the identification string itself,
represents the type of action to take.
Blank lines and lines with a hash mark (#) as the first nonblank
character are ignored. A line may be continued onto the next line by
ending the line in a backslash (\).
is a nonnegative integer, which can be represented either in decimal
form (default), octal form (preceded by
or hexadecimal form (preceded by
is a string of characters, which may include C-style \-escape
sequences. In addition, the sequence \? can be used to represent a
``wildcard'' byte. If the string includes spaces, the spaces have to
be preceded by a backslash, or the entire string must be enclosed in
double quotation marks.
For ambiguous matches, the first match is used. Hence, the most
specific match should always be placed first in the file. In
addition, the last line may be of the form:
which designates a default action to be used in case no other action
matches. This will typically be the action for plain text.
provides the following options for the
field in the configuration file:
cat [prefix [suffix]]
Copy the input to the output without any conversion, like the
command. If the optional
strings are specified, they are transmitted to the printer immediately
before and after the data itself. The
strings are specified in the same way as the
string (except that the wildcard sequence \? is not permitted), and like
sequence can contain any control character, including nulls (\0). To
specify an empty
string enclosed in double quotes (i.e. "").
text [prefix [suffix]]
Copy the input to the output, but add carriage return characters
before every line feed and form feed character in the file, and a line
feed-form feed sequence at end of file.
arguments are treated the same way as for the
if present, is added after the final line feed-form feed sequence.
Same as the
facility, except add an ASCII EOT (Ctrl-D) character to the end of the
data. This lets a PostScript printer know that the end of the job has
been reached. This is functionally equivalent to the command
text "" \004
Ignore the job; do not provide any output whatsoever.
Same as the
facility, but attempt to send an email message to the user who
submitted the job to inform that a job has been rejected and why.
Run the given
feeding it the input data, and sending the output data to the printer.
The environment variables
is set to the values of the user, host and indent options passed to
is fed to
it may contain shell special characters, and the sequences
can be used to access the values of the passed environment variables.
daemon on the system is LPRng, the following environment variables are also
available, see the
section for details:
Same as the
facility, except that the output data is fed back into
for reprocessing. This is used for external filter programs which
themselves do not produce a format that the printer can accept, but
which can be futher processed to obtain such a format.
Same as the
facilities, respectively, except that the input is written to a
temporary file before being fed to the filter program given by
This is useful for programs which require seekable input, such as
or which need to do multiple passes over an input file, such as
The environment variable
is set to the name of the temporary file (and, like the other ones, it
can be accessed on the command line as
facility together with
lets you transparently print compressed files.
collections of image conversion utilities contain a large number of
very useful external filter programs.
You will probably want to examine the sample configuration files
included with the
distribution before creating your own.
Some data formats cannot be easily identified by a simple fixed-offset
magic number check.
Providing large offsets can cause
to take up lots of memory. Fortunately, large offsets for magic
numbers are pretty much unheard of.
Currently, there is no protection against the
facilities going into an infinite loop.