diff options
author | Wolfram Schneider <wosch@FreeBSD.org> | 1997-01-02 22:47:46 +0000 |
---|---|---|
committer | Wolfram Schneider <wosch@FreeBSD.org> | 1997-01-02 22:47:46 +0000 |
commit | f5bc5997b24114f383586d72086ad33c5031e895 (patch) | |
tree | ef16fd22f6bdb83df08f2c5f243403f4098be2e6 /share/examples/printing/hpdf | |
parent | c13b19be64e4516f29da6154371b2dedfd2939be (diff) |
printing examples, automatically generated from
src/share/doc/handbook/printing.sgml with src/tools/tools/epfe/epfe.pl
Notes
Notes:
svn path=/head/; revision=21240
Diffstat (limited to 'share/examples/printing/hpdf')
-rw-r--r-- | share/examples/printing/hpdf | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/share/examples/printing/hpdf b/share/examples/printing/hpdf new file mode 100644 index 000000000000..d03c3ac70dfd --- /dev/null +++ b/share/examples/printing/hpdf @@ -0,0 +1,59 @@ +#!/bin/sh +# +# hpdf - Print DVI data on HP/PCL printer +# Installed in /usr/local/libexec/hpdf + +PATH=/usr/local/bin:$PATH; export PATH + +# +# Define a function to clean up our temporary files. These exist +# in the current directory, which will be the spooling directory +# for the printer. +# +cleanup() { + rm -f hpdf$$.dvi +} + +# +# Define a function to handle fatal errors: print the given message +# and exit 2. Exiting with 2 tells LPD to do not try to reprint the +# job. +# +fatal() { + echo "$@" 1>&2 + cleanup + exit 2 +} + +# +# If user removes the job, LPD will send SIGINT, so trap SIGINT +# (and a few other signals) to clean up after ourselves. +# +trap cleanup 1 2 15 + +# +# Make sure we are not colliding with any existing files. +# +cleanup + +# +# Link the DVI input file to standard input (the file to print). +# +ln -s /dev/fd/0 hpdf$$.dvi || fatal "Cannot symlink /dev/fd/0" + +# +# Make LF = CR+LF +# +printf "\033&k2G" || fatal "Cannot initialize printer" + +# +# Convert and print. Return value from dvilj2p does not seem to be +# reliable, so we ignore it. +# +dvilj2p -M1 -q -e- dfhp$$.dvi + +# +# Clean up and exit +# +cleanup +exit 0 |