Add a wlan_ratectl(4) manual page and reference it from drivers that support
[dragonfly/vkernel-mp.git] / share / examples / printing / hpdf
blobd03c3ac70dfdc48af994404c3f5bc2f528784809
1 #!/bin/sh
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
11 # for the printer.
13 cleanup() {
14 rm -f hpdf$$.dvi
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
20 # job.
22 fatal() {
23 echo "$@" 1>&2
24 cleanup
25 exit 2
29 # If user removes the job, LPD will send SIGINT, so trap SIGINT
30 # (and a few other signals) to clean up after ourselves.
32 trap cleanup 1 2 15
35 # Make sure we are not colliding with any existing files.
37 cleanup
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"
45 # Make LF = CR+LF
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
56 # Clean up and exit
58 cleanup
59 exit 0