The pipelines for generating header and trailer pages are defined by the system administation attributes sh (header pages) and st (trailer pages). The printing of header and trailer pages are separate processes from the spooler print jobs they accompany, even though they are not shown in the output of queue status queries.
Below is the sh attribute used to define the pipeline for header page generation and printing for an extended ASCII queue on an IBM 4029 LaserPrinter. The attribute is shown as formatted by the lsvirprt command. See "Viewing, Formatting, or Modifying Virtual Printer Definitions" for a further explanation.
Pipeline for Header Page sh = %Ide/pioburst %F[H] %Idb/H.ascii | %Ide/pioformat -@%Idd/%Imm -!%Idf/piof52 02 -L! -J! %IsH -u%IuH
%Ide INCLUDE: (Directory Containing Miscellaneous Modules) '/pioburst ' %F[H] If "-H] Argument" on Command Line, "-# Argument" -> OUTPUT ' ' %Idb INCLUDE: (Directory Containing Header and Trailer Text Files) '/H.ascii | ' %Ide INCLUDE: (Directory Containing Miscellaneous Modules) '/pioformat -@' %Idd INCLUDE: (Directory Containing Digested Data Base Files) '/' %Imm INCLUDE: (File Name Of (Digested) Data Base; Init. By "piodigest" (mt.md.mn.mq:mv)) ' -!' %Idf INCLUDE: (Directory Containing Loadable Formatter Routines) '/piof5202 -L! -J! ' %IsH INCLUDE: (FORMATTING FLAGS for header page) ' -u' %IuH INCLUDE: (Input PAPER TRAY for header page)
During spooler job processing, the value of the sh attribute is determined to be:
/usr/lib/lpd/pio/etc/pioburst /usr/lib/lpd/pio/burst/H.ascii | /usr/lib/lpd/pio/etc/pioformat -@/var/spool/lpd/pio/@local/ddi/ibm4029.asc.lp1.asc:lp1 -!/usr/lib/lpd/pio/fmtrs/piof5202 -L! -J! -u1
pioburst processes the header page template and pipes its output to the device-independent formatter, pioformat, which in turn loads the digested version of the colon file for this virtual printer (the argument to the -@ flag) and the device-dependent formatter, piof5202 (the argument to the -! flag). There are three flags to piof5202:
The value of the st definition is similar to the value of the sh definition.
The root user can create custom header pages for users by modifying the definiton of the sh attribute. Since the spooler processes have access to the environment of the user that submitted the job to the spooler, the root user can modify the portion of the sh attribute definition that specifies which header page template to process.
For example, the H.ascii in the above definition specifies which header page template should be processed and printed. It can be replaced with a user environment variable of your choice, such as $MYHEADER, as shown below.
%Ide INCLUDE: (Directory Containing Miscellaneous Modules) '/pioburst ' %F[H] If "-H] Argument" on Command Line, "-# Argument" -> OUTPUT ' ' %Idb INCLUDE: (Directory Containing Header and Trailer Text Files) '/$MYHEADER | ' %Ide INCLUDE: (Directory Containing Miscellaneous Modules) '/pioformat -@' %Idd INCLUDE: (Directory Containing Digested Data Base Files) '/' %Imm INCLUDE: (File Name Of (Digested) Data Base; Init. By "piodigest" (mt.md.mn.mq:mv)) ' -!' %Idf INCLUDE: (Directory Containing Loadable Formatter Routines) '/piof5202 -L! -J! ' %IsH INCLUDE: (FORMATTING FLAGS for header page) ' -u' %IuH INCLUDE: (Input PAPER TRAY for header page)
To enable the user susan to get custom header pages with this queue, the root user could use the following procedure:
When the user susan submits a job to this queue, the sh attribute's reference to a header page template will resolve to /usr/lib/lpd/pio/burst/H.susan, and the user susan will receive a custom header page. The problem with this scenario is that the environment variable MYHEADER must be defined for anyone that uses the queue associated with this virtual printer, else the virtual printer cannot resolve the reference to /usr/lib/lpd/pio/burst/$MYHEADER. An error will result if $MYHEADER is undefined; the job might print, but the header page will be recyclable at best.
To avoid the problem of everyone that uses this queue having to have MYHEADER defined, you can integrate some shell code into the sh attribute definition to examine the user environment before the header page pipeline is created. One method for doing this is shown below.
Pipeline for Header Page sh = { if test X"$MYHEADER" = X ; then %Ide/pioburst %F[H] %Idb/H.ascii | %Ide/pioformat -@%Idd/%Imm -!%Idf/piof5202 -L! -J! %IsH -u%IuH; else %Ide/pioburst %F[H] %Idb/$MYHEADER | %Ide/pioformat -@%Idd/%Imm -!%Idf/piof5202 -L! -J! %IsH -u%IuH; fi; }
'{ if test X"$MYHEADER" = X ; then ' %Ide INCLUDE: (Directory Containing Miscellaneous Modules) '/pioburst ' %F[H] If "-H] Argument" on Command Line, "-# Argument" -> OUTPUT ' ' %Idb INCLUDE: (Directory Containing Header and Trailer Text Files) '/H.ascii | ' %Ide INCLUDE: (Directory Containing Miscellaneous Modules) '/pioformat -@' %Idd INCLUDE: (Directory Containing Digested Data Base Files) '/' %Imm INCLUDE: (File Name Of (Digested) Data Base; Init. By "piodigest" (mt.md.mn.mq:mv)) ' -!' %Idf INCLUDE: (Directory Containing Loadable Formatter Routines) '/piof5202 -L! -J! ' %IsH INCLUDE: (FORMATTING FLAGS for header page) ' -u' %IuH INCLUDE: (Input PAPER TRAY for header page) '; else ' %Ide INCLUDE: (Directory Containing Miscellaneous Modules) '/pioburst ' %F[H] If "-H] Argument" on Command Line, "-# Argument" -> OUTPUT ' ' %Idb INCLUDE: (Directory Containing Header and Trailer Text Files) '/$MYHEADER | ' %Ide INCLUDE: (Directory Containing Miscellaneous Modules) '/pioformat -@' %Idd INCLUDE: (Directory Containing Digested Data Base Files) '/' %Imm INCLUDE: (File Name Of (Digested) Data Base; Init. By "piodigest" (mt.md.mn.mq:mv)) ' -!' %Idf INCLUDE: (Directory Containing Loadable Formatter Routines) '/piof5202 -L! -J! ' %IsH INCLUDE: (FORMATTING FLAGS for header page) ' -u' %IuH INCLUDE: (Input PAPER TRAY for header page) '; fi; } '
The original st definition is repeated twice in the new st definition. The shell code checks to see if MYHEADER is defined; if MYHEADER is not defined, then the header page template H.ascii is used, else the header page template $MYHEADER is used.