3 # hpdf - Print DVI data on HP/PCL printer
4 # Installed in /usr/local/libexec/hpdf
6 PATH
=/usr
/local
/bin
:$PATH; export PATH
9 # Define a function to clean up our temporary files. These exist
10 # in the current directory, which will be the spooling directory
18 # Define a function to handle fatal errors: print the given message
19 # and exit 2. Exiting with 2 tells LPD to do not try to reprint the
29 # If user removes the job, LPD will send SIGINT, so trap SIGINT
30 # (and a few other signals) to clean up after ourselves.
35 # Make sure we are not colliding with any existing files.
40 # Link the DVI input file to standard input (the file to print).
42 ln -s /dev
/fd
/0 hpdf$$.dvi || fatal
"Cannot symlink /dev/fd/0"
47 printf "\033&k2G" || fatal
"Cannot initialize printer"
50 # Convert and print. Return value from dvilj2p does not seem to be
51 # reliable, so we ignore it.
53 dvilj2p
-M1 -q -e- dfhp$$.dvi