Subject: Solved: printcap for imagewriter ii
To: None <port-mac68k@netbsd.org>
From: Douglas R. Troeger <dtroeger@ix.netcom.com>
List: port-mac68k
Date: 11/03/1999 08:25:48
This is a multi-part message in MIME format.
--------------F8B97F0D40956EC81AF2F51F
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

 
--------------F8B97F0D40956EC81AF2F51F
Content-Type: text/plain; charset=us-ascii; name="printing"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="printing"

For reference, here is a printcap/filter combination which works
with the Imagewriter II, NetBSD 1.3.3, and Ghostscript 5.50.


The printcap entry:

apple|lp|ImageWriter II:\
	:sh:\
	:sd=/var/spool/lpd/apple:\
	:lp=/dev/tty01:\
	:lf=/var/log/lpd-errs:\
	:br#9600:\
	:ms=crtscts,clocal,-opost:\
	:if=/usr/pkg/libexec/if-iwhi:


The filter:

#!/bin/sh
#
# iwhi - Print Ghostscript-simulated Postscript on an Apple Imagewriter II
# Installed in /usr/bin/libexec/if-iwhi

#
#  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/pkg/bin/gs -dSAFER -dNOPAUSE -q -sDEVICE=iwhi -sOutputFile=- - \
	    && exit 0
else
	# 
	# Plain text, so just print it directly; print a form
	# at the end to eject the last page
	#
	echo "$first_line" && cat && printf "\f" && exit 0
fi

exit 2




--------------F8B97F0D40956EC81AF2F51F--