Option definition with templates

A template is a statement in a filter definition that defines an option to be passed to the filter command based on the value of one of the characteristics of the filter.

A filter definition may include more than one template. Multiple templates may be entered on a single line and separated with commas, or they may be entered on separate lines, preceded by the Options: prefix.

The format of a template is as follows:

keyword pattern=replacement

This type of statement is interpreted by the print service to mean: "When the information referred to by keyword has the value matched by pattern, take the replacement string, replace any asterisks it contains with the pattern specified or expand any regular expressions it contains, and append the result to the command line."

As an example, suppose you want to have the print service scheduler assign print requests to filters on the basis of the following criteria:

  • If the type of OUTPUT to be produced by the filter is impress, then pass the -I option to the filter.
  • If the type of OUTPUT to be produced by the filter is postscript, then pass the -P option to the filter.

To specify these criteria, provide the following templates as options to the lpfilter command:

  Options: OUTPUT impress=-I, OUTPUT postscript=-P

If the Options: line becomes too long, put each template on a separate line, as follows:

  "Options: OUTPUT impress=-I"
  "Options: OUTPUT postscript=-P"

In both templates, the keyword is OUTPUT. In the first template, the value of pattern is impress and the value of the replacement is -I. In the second template, the value of pattern is postscript and the value of replacement is -P.