Subject: bin/11907: Default /etc/printcap file needs more modern samples
To: None <gnats-bugs@gnats.netbsd.org>
From: None <anders@dinsen.net>
List: netbsd-bugs
Date: 01/07/2001 06:08:19
>Number:         11907
>Category:       bin
>Synopsis:       Default /etc/printcap file needs more modern samples
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun Jan 07 06:08:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Anders Dinsen
>Release:        1.5
>Organization:
Anders Dinsen
anders@dinsen.net
http://dinsen.net/anders/
>Environment:
	
System: NetBSD box 1.5 NetBSD 1.5 (BOX) #0: Wed Dec 27 21:49:47 CET 2000 anders@box:/usr/src/sys/arch/i386/compile/BOX i386


>Description:
The default /etc/printcap has no entries that are suitable for
PostScript printers. This caused me great trouble because the default
entry for "lp" does not suppress a header page. A printer entry with
a postscript filter would also be very useful.

>How-To-Repeat:
Try printing on a PostScript printer with the default printcap
entry for "lp".

>Fix:
Include the following sample entry in the default /etc/printcap:

ps|PostScript printer:\
    :lp=/dev/lpa2:sf:sh:mx#0:sd=/var/spool/lpd/lp:lf=/var/log/lpd-errs:

The following entry would also be useful in combination with the
script given below (requires installation of the a2ps package) since
it turns queue lp into an ordinary ASCII printer:

lp|Line printer with PostScript filter:\
    :lp=/dev/null:sh:sd=/var/spool/lpd:of=/usr/local/libexec/psf:pl#70:pw#80:

Here is a script that will do the filter job:

#!/bin/sh
# This is an ascii to PostScript filter intended for use as an
# output filter in a printer entry in /etc/printcap. E.g.:
#
# lp|Line printer with PostScript filter:\
#     :lp=/dev/null:sh:sd=/var/spool/lpd:of=/usr/local/libexec/psf:pl#70:pw#80:
#
# This script requires that the a2ps package is installed.

# These are the defaults stated in printcap(5)
width=132
length=66

# This is the page format, e.g. ISO A4 or letter
medium=A4

# PostScript queue
outputQueue=ps

args=`getopt w:l: $*`
set -- $args
for i
do
   case "$i"
   in
	   -w)
		   width=$2; shift; shift;;
	   -l)
		   length=$2; shift; shift;;
	   --)
		   shift; break;;
   esac
done
/usr/pkg/bin/a2ps -q -1 -M $medium --borders no --no-header -L $length -l $width -P$outputQueue 2>&1 | logger -p lpr.info -t $0
>Release-Note:
>Audit-Trail:
>Unformatted: