Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 Aug 1997 17:03:03 -0400 (EDT)
From:      chris@stonos.washington.dc.us
To:        Sean Kelly <kelly@fsl.noaa.gov>
Cc:        hackers@freebsd.org, bugs@freebsd.org
Subject:   FreeBSD docs on printers -- correction (minor)
Message-ID:  <199708242103.RAA00920@thanatos.stonos.washington.dc.us>

next in thread | raw e-mail | index | archive | help
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.





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199708242103.RAA00920>