$PRINTER environment variable in Unix

Robert Evans robert at computing-maths.cardiff.ac.uk
Tue Aug 9 21:26:13 AEST 1988


In article <1988Aug2.085719.11489 at gpu.utcs.toronto.edu>, romwa at gpu.utcs.toronto.edu (Mark Dornfeld) writes:
> Is there a "standard" method for implementation of a $PRINTER
> environment variable in a user's shell?  When several printers
> are on a single system, it is usually desirable to have user
> output appear on the printer closest to his/her work area
> instead of on a printer six floors up and on the other side of
> the building.

I do this for our Ultrix system using the "ev" capability in the /etc/gettytab
terminal configuration data base.   I want prints from terminals in one room
to go to printer "lp1" instead of the default "lp".  These terminals are all
hard-wired.  The type fields in /etc/ttys for the special files corresponding
to the terminals in this room reference entries in /etc/gettyab which contain
the field:- :ev=PRINTER=lp1:

This environment variable is passed by getty to login and hence to the shell.
The man page gettytab(5) for Ultrix 2.0 states that login recreates its
environment so that this technique wouldn't work.  However, this is not true
as the following comment from the source of login shows:
 * 
 * Revision 1.6  84/10/25  14:12:23  jg
 * Undid utmp changes.  Added -p flag to preserve environment passed
 * from getty.
 * 
It may be true on some versions of UNIX though.
The man page for gettytab for SunOS 3.5 also lists the "ev" capability.

One problem we had in having PRINTER set, was that it altered the destination of
prints produced by Adobe's PostScript filter programs psroff, ptroff and
enscript.  By default, these send their output to device PostScript but if
PRINTER is set, they send it there instead.  Since this is never what is
intended here, I've changed the scripts psroff and ptroff and the binary
enscript to use a variable LASER for an alternative destination instead of
PRINTER.
-- 
-- 
  Robert Evans, Dept of Computing Maths, University College Cardiff,
  PO Box 916, Cardiff, Wales, UK, CF2 4YN.  Tel: +44 (0)222 874000 x 5518
  E-mail: R.Evans at computing-maths.cardiff.ac.uk     UUCP: R.Evans at cf-cm.UUCP



More information about the Comp.unix.questions mailing list