From owner-freebsd-hackers Sun Aug 24 14:06:17 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id OAA21424 for hackers-outgoing; Sun, 24 Aug 1997 14:06:17 -0700 (PDT) Received: from thanatos.stonos.washington.dc.us (Thanatos.i3inc.com [208.218.26.195]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id OAA21368; Sun, 24 Aug 1997 14:05:36 -0700 (PDT) Received: (from root@localhost) by thanatos.stonos.washington.dc.us (8.8.5/8.8.5) id RAA00920; Sun, 24 Aug 1997 17:03:03 -0400 (EDT) Date: Sun, 24 Aug 1997 17:03:03 -0400 (EDT) Message-Id: <199708242103.RAA00920@thanatos.stonos.washington.dc.us> To: Sean Kelly From: chris@stonos.washington.dc.us cc: hackers@freebsd.org, bugs@freebsd.org Subject: FreeBSD docs on printers -- correction (minor) Sender: owner-freebsd-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Just picked up FreeBSD-2.2.2-RELEASE and was going through your lpr setup docs dated 30 September 1995. Found one buglet in a filter code example near the bottom: Here is an example: the following script is a text filter for Hewlett Packard DeskJet 500 printers. For other printers, substitute the -sDEVICE argument to the gs (Ghostscript) command. (Type gs -h to get a list of devices the current installation of Ghostscript supports.) #!/bin/sh # # ifhp - Print Ghostscript-simulated PostScript on a DeskJet 500 # Installed in /usr/local/libexec/hpif # # Treat LF as CR+LF: # printf "\033&k2G" || exit 2 # # Read first two characters of the file # read first_line first_two_chars=`expr "$first_line" : '\(..\)'` if [ "$first_two_chars" = "%!" ]; then # # It is PostScript; use Ghostscript to scan-convert and print it # /usr/local/bin/gs -dSAFER -dNOPAUSE -q -sDEVICE=djet500 -sOutputFile=- - \ && exit 0 else # # Plain text or HP/PCL, so just print it directly; print a form # at the end to eject the last page. # echo $first_line && cat && printf "\f" && exit 2 fi ============================================================^ exit 2 Finally, you need to notify LPD of the filter via the if capability: :if=/usr/local/libexec/hpif: That "exit 2" should be an "exit 0" for successful completion of plain text output. Thanks for the docs. Very helpful and much cleaner than the way I used to do it.