NetBSD Problem Report #11907

Received: (qmail 10978 invoked from network); 7 Jan 2001 14:07:18 -0000
Message-Id: <200101071407.f07E72k02054@box.lan.dinsen.net>
Date: Sun, 7 Jan 2001 15:07:02 +0100 (CET)
From: anders@dinsen.net
Reply-To: anders@dinsen.net
To: gnats-bugs@gnats.netbsd.org
Subject: Default /etc/printcap file needs more modern samples
X-Send-Pr-Version: 3.95

>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 14:08:01 +0000 2001
>Closed-Date:    
>Last-Modified:  Sun Jan 20 07:45:33 +0000 2019
>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:

From: woods@weird.com (Greg A. Woods)
To: gnats-bugs@gnats.netbsd.org (NetBSD GNATS submissions and followups),
	netbsd-bugs@NetBSD.ORG (NetBSD Bugs and PR posting List)
Cc:  
Subject: Re: bin/11907: Default /etc/printcap file needs more modern samples
Date: Sun,  7 Jan 2001 20:22:23 -0500 (EST)

 [ On Sunday, January 7, 2001 at 15:07:02 (+0100), anders@dinsen.net wrote: ]
 > Subject: bin/11907: Default /etc/printcap file needs more modern samples
 >
 > 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:

 Note that all the example entries in /etc/printcap should also be
 converted to use the modern, hier(7) approved, /var/spool/output/ as the
 spool directory prefix.  /var/spool/lpd is apparently deprecated, and
 the new default for "sd=" is "/var/spool/output/lpd".

 Note also that PostScript printers typically can talk back to the host
 their attached to (esp. if they are on a serial port, but many support
 bi-directional parallel ports too, for example the Apple LaserWriter
 16/600PS and Color LW 12/600PS both contain a bi-directional parallel
 port that conforms to the IEEE 1284 standard), so as to do things like
 report the current printer status, read responses to specific queries
 such as finding out the printer's total page count for job accounting,
 report errors encountered in PostScript jobs, etc.

 To make use of this feature one generally has to have a smart interface
 program that knows how to talk to a PostScript printer on behalf of
 "lpd".  One such program that can do this is the "postio" program from
 AT&T (in V9, SysVr4, and Plan-9) "lprps" by James Clark, available at
 <URL:ftp://ftp.jclark.com/pub/lprps/lprps-2.5.tar.Z>.  There's currently
 no pkgsrc module for lprps, but there's been one in FreeBSD's ports
 system for quite some time so it shouldn't be hard to convert over....
 (The "ifhp" filter in LPRng can apparently also do this.)

 Note: I've not attempted recently, but in NetBSD-1.3.2 and earlier there
 was something broken in LPD that prevented lprps from ever successfully
 sending a job to the printer (though it could communicate with the
 printer and successfully retrieved the page counts and status, etc.).
 IIRC the bug has something to do with LPD apparently not sending the job
 to the filter's stdin, or something like that.

 Another common PostScript printer issue is how to load fonts into the
 printer for those jobs that need them (i.e. any font other than the
 usual 35 built-in fonts found in most true PostScript printers).
 Unfortunately lprps isn't smart enough to scan the job and pre-load any
 fonts it might need.  The printing system included in AT&T UNIX System V
 Release 4 had a basic PostScript filter (download) that could do this,
 but I've not yet encountered any freeware one.  There is a copy of
 download (and postio) in the Plan 9 source, but I don't know if it's
 truly freely available.

 Note that there is some very minimal support for specifying up to four
 font files to any printer queue when printing files with one of `-d',
 `-n', or `-t'.  This is an extremely undocumented part of the LPR
 system (I have some half-baked fixes to the manual pages), though
 basically all it does is write four pathnames to a ".railmag" file in
 the spool directory and it is expected that the "df", "nf", or "tf"
 filter program will read this file and "Do The Right Thing(tm)".


 An example should probably be given for a remote PostScript printer too:

 # Typical remote PostScript printer entry.
 psrem|Remote PostScript Printer:\
 	:rm=remote_machine_hostname:\
 	:mx#0:sf:sh:sb:\
 	:lf=/var/log/lpd-errs:

 And maybe one for a printer on a terminal server:

 # Typical PostScript printer connected to a terminal server that listens
 # on a TCP port specified below as "port#".
 psts|PostScript Printer on Terminal Server:\
 	:lp=port#@terminal_server_hostname:\
 	:mx#0:sf:sh:sb:\
 	:lf=/var/log/lpd-errs:


 I don't know how common Apple's TCP/IP LPD implementation is in their
 newer printers, but with at least the Apple LaserWriter 16/600PS and the
 Color 12/600PS the following entries are useful:

 # Entries suitable for an Apple LaserWriter with TCP/IP (eg. 16/600PS)
 #
 # the remote printer name (rp) specifies how the printer will treat the
 # input data.  "raw" is suitable for PostScript or HP PCL-5 output, and
 # "text" is suitable for ASCII (an ASCII CR is appended to every line so
 # as to avoid the stair-step effect when printing Unix text files)
 #
 # The printer's Ethernet port should be configured to "AutoSelect" for
 # TCP/IP, which is the default on a 16/600PS if the configuration switch
 # is in the "down" position.
 #
 # Unfortunately in this mode the printer cannot report job errors.
 #
 text|Apple LaserWriter w/TCP-IP as a text printer:\
         :rm=printer-hostname.example.com:\
 	:rp=text:\
         :mx#0:sf:sh:sb:\
         :rg=staff:rs:\
         :lf=/var/log/lpd-errs:
 #
 ps|pcl|Apple LaserWriter w/TCP-IP as a PostScript or PCL-5 printer:\
         :rm=printer-hostname.example.com:\
 	:rp=raw:\
         :mx#0:sf:sh:sb:\
         :rg=staff:rs:\
         :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:

 Note that the NetAtalk printer support filter is also called 'psf',
 though its actual filter programs have other names.

 Note also that the 'enscript' program is also a suitable filter for
 converting from text to PostScript, and there's 'pcps', 'mpage', and
 even 'mp' too (and all are in pkgsrc).


 I find the following comments are also useful to assist non-experts in
 configuring their printers:

 # To keep the peons from printing you can add a line such as this to any entry:
 #	:rg=staff:rs:\
 # which says that only users who are members of the group 'staff', and who have
 # accounts on the local host, will be allowed to print.
 #
 # "lpr" defaults to using the printer called "lp" -- add that name as an alias
 # for your most commonly used, or default, printer.
 #
 # Each printer should have a unique spool directory (sd=) of its own, which
 # must be created before lpd is restarted.  If you only have one printer you
 # can use the existing default spool directory (/var/spool/output/lpd).

 -- 
 							Greg A. Woods

 +1 416 218-0098      VE3TCP      <gwoods@acm.org>      <robohack!woods>
 Planix, Inc. <woods@planix.com>; Secrets of the Weird <woods@weird.com>
Responsible-Changed-From-To: bin-bug-people->jruoho
Responsible-Changed-By: jruoho@NetBSD.org
Responsible-Changed-When: Tue, 03 May 2011 17:55:41 +0000
Responsible-Changed-Why:

Take. While lpd(8) lives firmly in the past century, this is a worthwhile
idea. I will add some of the noted examples and some of my own.



Responsible-Changed-From-To: jruoho->bin-bug-people
Responsible-Changed-By: dholland@NetBSD.org
Responsible-Changed-When: Sun, 20 Jan 2019 07:45:33 +0000
Responsible-Changed-Why:
Reset responsible field for retired developer.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.