v16i015: Public lineprinter spooler package, Part02/16

Rich Salz rsalz at uunet.uu.net
Thu Sep 15 06:13:32 AEST 1988


Submitted-by: papowell at julius.cs.umn.edu
Posting-number: Volume 16, Issue 15
Archive-name: plp/part02



#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 2 (of 16)."
# Contents:  ANNOUNCE FILES doc/PLP/00.t doc/PLP/03.t doc/PLP/10.t
#   doc/PLP/12.t doc/PLP/announce filters/compat.c man/checkpc.1
#   man/pac.8 man/printer.1 man/printers.1 src/find_name.c
#   src/getprinter.c src/lpr.h src/lpr_global.c src/startserver.c
#   src/termclear.c utilities/cpr/cpr.1
# Wrapped by papowell at attila on Wed Aug 10 10:44:46 1988
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'ANNOUNCE' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'ANNOUNCE'\"
else
echo shar: Extracting \"'ANNOUNCE'\" \(2540 characters\)
sed "s/^X//" >'ANNOUNCE' <<'END_OF_FILE'
X              PLP - The Public Line Printer Spooler
X               A Portable UNIX Line Printer Spooler
X                     Release 2.0, 1 June 1988
X                       Prof. Patrick Powell
X                    Dept. of Computer Science
X         University of Minnesota, Minneapolis, Minnesota
X     PLP is a public domain version of the Berkeley LPD software.
The  functional  resemblance  between  PLP  and the Berkeley Line
Printer Spooler (LPD) is intentional; the source code was written
without  reference  to the original Berkeley LPD software, except
for  some  very  small sections concerned with networking and the
large  characters used for banner printing.  The PLP software has
the following features:
X1).The  PLP  software is intended to be  used in a Networked File
X   System  (NFS)  environment,  in which there is a common set of
X   spool  queues,  as well as in a loosely coupled environment in
X   which  each  host transfers print jobs to a host which has the
X   printer.
X2).Access  and  permission  to use PLP functions is controlled by
X   entries      in      a      printer      permissions      file
X   (/usr/spool/lpd/printer_perms.<hostname>)  which  can restrict
X   use  by  user  name, host, spooler, page useage, and a host of
X   other         factors.         The        printcap        file
X   (/usr/spool/lpd/printcap.<hostname>)  is  used  to specify the
X   printer queues and their operation.
X3).Jobs  can now be prioritized.  The maximum priority a user can
X   specify is set in the printer permissions file.
X4).In  addition  to  the  general  printer permissions file, each
X   spool  queue  can  have  its  own addition printer permissions
X   file.
X5).Line  printer control functions can be exercised from a remote
X   host.   Hosts  and  users  with  remote control permission are
X   specified by entries in the printer permissions file.
X6).Unspooling  of  jobs  can be performed by a printcap specified
X   program, rather than by the PLP unspooler.  This allows PLP to
X   be used as a spooler and to have spool queues used for various
X   purposes.
X7).Extremely  verbose  and chatty error messages have been added.
X   These  greatly  ease debugging and installation.  In addition,
X   the  checkpc  utility  can be used to set file permissions and
X   other items for use by the PLP software.
X8).The code is quite portable, with as few system dependencies in
X   it as possible.  It has run on a VAX 4.2, 4.3, and ULTRIX, SUN
X   3.0, and DG-UX.
X____________
X* UNIX is a trademark of ATT Bell Laboratories.
END_OF_FILE
if test 2540 -ne `wc -c <'ANNOUNCE'`; then
    echo shar: \"'ANNOUNCE'\" unpacked with wrong size!
fi
# end of 'ANNOUNCE'
fi
if test -f 'FILES' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'FILES'\"
else
echo shar: Extracting \"'FILES'\" \(2713 characters\)
sed "s/^X//" >'FILES' <<'END_OF_FILE'
ANNOUNCE
Copyright
XFILES
MANIFEST
LICENSE
Makefile
README
backup
backup/lpr.remove
backup/save.lpr
backup/restore.lpr
backup/Makefile
backup/lpr.save
doc
doc/PLP
doc/PLP/12.t
doc/PLP/dict
doc/PLP/02.t
doc/PLP/03.t
doc/PLP/04.t
doc/PLP/05.t
doc/PLP/06.t
doc/PLP/11.t
doc/PLP/07.t
doc/PLP/Makefile
doc/PLP/README
doc/PLP/macros
doc/PLP/09.t
doc/PLP/10.t
doc/PLP/00.t
doc/PLP/announce
doc/PLP/01.t
doc/PLP/08.t
doc/PLP/LICENSE
filters
filters/compat.c
filters/Makefile
filters/lpf.c
filters/main.c
filters/pf_main.c
filters/pref_main.c
filters/vdmp.c
man
man/lpq.1
man/lpr.1
man/lprm.1
man/Makefile
man/pac.8
man/README
man/lpd.8
man/printcap.5
man/printer.1
man/printers.1
man/lpc.1
man/checkpc.1
printcap
printcap/hosts
printcap/hosts/dg
printcap/hosts/julius
printcap/hosts/umn-cs
printcap/printers
printcap/printers/diablo_lind136.remote
printcap/printers/dg2_lind25.remote
printcap/printers/dg3_lind25.remote
printcap/printers/hp2563_lind25.remote
printcap/printers/hp_lind54.remote
printcap/printers/epson_lind27.remote
printcap/printers/dgt_lind27.remote
printcap/printers/apple_lind26a.remote
printcap/printers/apple_lind26a.local
printcap/printers/imagen_lind27.local
printcap/printers/imagen_lind27.remote
printcap/printers/diablo_lind136.local
printcap/printers/dg1_lind1.remote
printcap/printers/laserjetplus_lind25.remote
printcap/printers/dg2_lind25.forward
printcap/printers/dg3_lind25.forward
printcap/printers/dgt_lind27.forward
printcap/printers/hp2563_lind25.forward
printcap/printers/hp_lind54.forward
printcap/printers/laserjetplus_lind25.forward
printcap/printers/dg1_lind1.forward
printcap/printcap
printcap/README
printcap/Makefile
printcap/genpc
src
src/banner.c
src/chartable.c
src/checkpc.c
src/checkperm.c
src/displayq.c
src/errormsg.c
src/getopt.c
src/getprinter.c
src/global.c
src/link_support.c
src/localprinter.c
src/lockfile.c
src/lpc.c
src/lpd.c
src/lpq.c
src/control_ops.c
src/lp.h
src/lpr_filters.c
src/lpr_global.c
src/utils.c
src/lpr_parms.c
src/lpr_temp.c
src/lprm.c
src/pac.c
src/mexecv.c
src/print_support.c
src/printcap.c
src/recvfiles.c
src/remoteprinter.c
src/rmjob.c
src/sendmail.c
src/servicereq.c
src/setstatus.c
src/setup_filter.c
src/setup_test.c
src/startprinter.c
src/lpr.c
src/Makefile
src/lpr.h
src/README
src/IDENT
src/remote_ops.c
src/find_name.c
src/startserver.c
src/termclear.c
src/lpr_job.c
src/lpr_canprint.c
src/patchlevel.h
test
test/filter.sh
test/printcap.proto
test/qh.sh
test/linetest.c
test/README
test/Makefile
test/printer_perms.proto
utilities
utilities/cpr
utilities/cpr/cpr.c
utilities/cpr/Makefile
utilities/cpr/cpr.1
utilities/print
utilities/print/print.sh
utilities/print/print.1
utilities/print/Makefile
utilities/Makefile
utilities/IDENT
END_OF_FILE
if test 2713 -ne `wc -c <'FILES'`; then
    echo shar: \"'FILES'\" unpacked with wrong size!
fi
# end of 'FILES'
fi
if test -f 'doc/PLP/00.t' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'doc/PLP/00.t'\"
else
echo shar: Extracting \"'doc/PLP/00.t'\" \(2536 characters\)
sed "s/^X//" >'doc/PLP/00.t' <<'END_OF_FILE'
X.ig
X$Header: 00.t,v 1.1 88/05/21 18:39:29 papowell Locked $
X$log$
X..
X.RP
X.EH 'PLP-%''PLP Manual'
X.OH 'PLP Manual''PLP-%'
X.nr CW 2.85i
X.nr GW .3i
X.TL
PLP \- The Public Line Printer Spooler
X.br
A Portable UNIX Line Printer Spooler
X.br
Release 2.0, 1 June 1988
X.AU
Prof. Patrick Powell
X.AI
Dept. of Computer Science
University of Minnesota, Minneapolis, Minnesota
X.AB
X.FS
X* UNIX is a trademark of ATT Bell Laboratories.
X.FE
This document describes the Public Line Printer Spooler (PLP).
The functional resemblance between this software and the
Berkeley Line Printer Spooler (LPD) is intentional.
The PLP software has the following features:
X.IP 1). 5
The PLP software is intended to be  used in a Networked File System
X(NFS) environment,
in which there is a common set of spool queues,
as well as in a loosely coupled environment in which each host
transfers print jobs to a common host.
X.IP 2). 5
Access and permission to use
PLP functions is controlled by entries in a printer permissions file
X.I (/usr/spool/lpd/printer_perms.<hostname>)
which can restrict use by user name,
host,
spooler,
page useage,
and a host of other factors.
The printcap file
X.I (/usr/spool/lpd/printcap.<hostname>)
is used to specify the printer queues and their operation.
X.IP 3). 5
Jobs can now be prioritized.
The maximum priority a user can specify is set in the
printer permissions file.
X.IP 4). 5
In addition to the general printer permissions file,
each spool queue can have its own addition printer permissions file.
X.IP 5). 5
Line printer control functions can be exercised from a remote host.
Hosts and users with
remote control permissions are specified
by entries in the printer permissions file.
X.IP 6). 5
The unspooling of jobs can be performed by a user defined program,
rather than the spooler.
This allows the spooler to be used to send jobs to remote sites
using various file transfer protocols.
X.IP 7). 5
XExtremely verbose and chatty error messages have been added.
These greatly ease debugging and installation.
In addition,
the
X.I checkpc
utility can be used to set file permissions and other items for
use by the PLP software.
X.PP
XFor complex legal reasons,
PLP is NOT public domain software,
but may be copied and/or modified as long as the original copyright
notification is retained.
X.AE
X.de IR
X\fI\\$1\fP\\$2
X..
X.de BR
X\fB\\$1\fP\\$2
X..
X.de DT
X.ta 4n +4n +4n +4n +4n +4n +4n +4n +4n +4n +4n 8i
X..
X.	\" CW - H - Helvetica
X.de L
X.nr pq \\n(.f
X.if t .ft CW
X.if n .ft 1
X.if !\e\\$1\e\e \&\\s-\\n(Ls\\$1\|\\s+\\n(Ls\f\\n(pq\\$2
X..
X.nr Ls 2
END_OF_FILE
if test 2536 -ne `wc -c <'doc/PLP/00.t'`; then
    echo shar: \"'doc/PLP/00.t'\" unpacked with wrong size!
fi
# end of 'doc/PLP/00.t'
fi
if test -f 'doc/PLP/03.t' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'doc/PLP/03.t'\"
else
echo shar: Extracting \"'doc/PLP/03.t'\" \(2930 characters\)
sed "s/^X//" >'doc/PLP/03.t' <<'END_OF_FILE'
X.ig
X$Header: 03.t,v 1.1 88/05/21 18:39:36 papowell Locked $
X$log$
X..
X.NH 1
Spool Directories, Programs, and Permissions
X.PP
XEach spool queue has a spool directory that contains the
control and data files associated with a job.
The permissions and ownerships of
spool directories and PLP software are intended to allow only PLP programs
to read,
write,
or remove jobs from the spool directory.
The strategy used to protect
spooling information is as follows:
X.IP 1). 4
XEach spool queue directory is owned by user
X.I daemon
and group
X.I deamon .
The spool queue directory permissions are 0755, i.e.-
user (daemon) rwx,
group (daemon) rx,
and other rx.
X.FS
These could be restricted to 0600,
user (daemon) rw only,
as PLP programs run SUID
X.IR root .
X.FE
X.IP 2). 4
All the PLP programs which modify or read the entries in the
spool queue directories run SUID
X.IR root .
The SUID
X.I root
is needed on several UNIX implementations in
order to change the file ownership and group information.
X.IP 3). 4
Control and data files in the spooling directories have owner
X.I daemon 
and
group
X.IR daemon .
This insures control and data files are not readable or modifiable by a
and ordinary user and that no ordinary user can remove files except through
X.IR lprm .
X.IP 4). 4
XEach spool queue has a
X.I lock
file which controls queueing and printing.
If the
X.I lock
has
X.I "owner execute"
permission set then unspooling is disabled;
if it has
X.I "group execute"
permissions set then spooling is disabled;
if it has
X.I "other execute"
permissions set then the spool queue should be reordered for
unspooling purposes.
X.IP 5). 4
Prevention of multiple instances of a spool queue server is done by
using the
X.IR flock (2),
or
X.IR lockf (3)
facility.
When a server starts,
it will try and lock the
X.I lock
file using
X.IR flock ;
if the lock fails then another server is active.
X.IP 6). 4
The active server process records its
X.I "process id"
and the name of the control file being processed in the
X.I lock
file.
This information is used by
X.I lpq
to report the queue activity.
X.IP 7). 4
Before processing a job,
the server process will lock the job's control file.
This prevents multiple PLP programs such as 
X.I lprm
and
X.I lpd
from operating on the same job simultaneously.
X.IP 8). 4
If there are multiple servers for a single queue,
the spool queue lock file is used to control spool activities,
and individual printer server lock files are used to control the printers.
X.IP 9). 4
XEach spool queue 
X.I status
file which is used to record the current status of the server process.
This information is displayed by
X.I lpq
and
X.IR lpc .
X.IP 10). 4
A server process is setuid
X.I root
and its process group its
X.I process
id.
Any subprocesses that it forks will be in the same process group.
The
X.I lprm
program uses 
X.IR killpg \|(2)
to signal an active server process.
The
X.I killpg
will effect the subprocess as well as the original server process.
END_OF_FILE
if test 2930 -ne `wc -c <'doc/PLP/03.t'`; then
    echo shar: \"'doc/PLP/03.t'\" unpacked with wrong size!
fi
# end of 'doc/PLP/03.t'
fi
if test -f 'doc/PLP/10.t' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'doc/PLP/10.t'\"
else
echo shar: Extracting \"'doc/PLP/10.t'\" \(3248 characters\)
sed "s/^X//" >'doc/PLP/10.t' <<'END_OF_FILE'
X.ig
X$Header: 10.t,v 1.1 88/05/21 18:39:51 papowell Locked $
X$log$
X..
X.NH 1
Troubleshooting
X.PP
The diagnostic messages issued by the PLP software
are verbose to the point of being obnoxious.
Usually there is enough information available to determine the exact cause
of problems.
However,
there are times when a bit of explanations do help.
X.PP
In order to get detailed diagnostic information from any of the
PLP software,
you can enable diagnostic messages using the
X.B -Dn
option to set debugging to level
X.IR n .
Level 0 disables diagnostics,
level 3 is chatty,
level 5 is pretty verbose,
and level 9 is absolutely everthing.
X.NH 2
LPD
X.PP
When lpd is started,
it will try and open a log file.
If it cannot,
it will log to /dev/null.
However,
important errors are logged using the
X.IR syslog (8)
facility.
You can specify a log file using the
X.B "-L filename"
option to lpd;
X.B "-L -"
will cause it to log error messages to standard output.
X.PP
XEach spool queue has an associated log file as well,
as does each server for a spool queue.
Most of the PLP software will also use
X.IR syslog (8)
for important messages,
or log them to
X.L /dev/console
if syslog is not available.
X.NH 2
LPR
X.SH
lpr: \fIprinter\fP\|: unknown printer
X.IP
The
X.I printer
was not found in the
X.I printcap
database.
Usually this is a typing mistake;
however,
it may indicate a missing or incorrect entry in the printcap file.
X.SH
lpr: \fIprinter\fP\|: jobs queued, but cannot start server.
X.IP
The connection to 
X.I lpd
on the local machine failed. 
This usually means the lpd process started at
boot time has died or is hung.
Use the
X.L "lpc lpd"
command to check that the
X.I lpd
process is running.
If it appears to be absent or not responding,
you restart the lpd process using the following commands.
X.DS
X.L
X.SM
X% /usr/lib/lpd
X.DE
X.NH 2
LPQ
X.SH
waiting for \fIprinter\fP to become ready (trying since ????)
X.IP
The printer device could not be opened by the server. 
This can happen for a number of reasons,
the most common being that the printer is turned off-line.
This message can also be generated if the printer is out
of paper, the paper is jammed, etc.
The actual reason is dependent on the meaning
of error codes returned by system device driver. 
Not all printers supply sufficient information 
to distinguish when a printer is off-line or having
trouble (e.g. a printer connected through a serial line). 
Another possible cause of this message is
some other process, such as an output filter,
has an exclusive open on the device.  Your only recourse
here is to kill off the offending program(s) and
restart the printer with
X.IR lpc .
X.SH
connecting to <host> (trying since ????)
X.IP
The server is trying to connect to the remote site and nothing has happened.
XFirst indication that the network is dead,
or the host you are trying to reach is down.
If the remote host is up,
X.I lpd
on the remote machine is probably dead or
hung and should be restarted.
X.SH
warning: no server present
X.IP
There are entries in the spool queue,
but no server exists.
This normally occurs only when the server has unexpectedly died.
The error log file for the spool queue should be checked for a
diagnostic from the deceased process.
Use the lpc restart command to start a server.
END_OF_FILE
if test 3248 -ne `wc -c <'doc/PLP/10.t'`; then
    echo shar: \"'doc/PLP/10.t'\" unpacked with wrong size!
fi
# end of 'doc/PLP/10.t'
fi
if test -f 'doc/PLP/12.t' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'doc/PLP/12.t'\"
else
echo shar: Extracting \"'doc/PLP/12.t'\" \(2119 characters\)
sed "s/^X//" >'doc/PLP/12.t' <<'END_OF_FILE'
X.ig
X$Header: 12.t,v 1.1 88/05/21 18:39:54 papowell Locked $
X$log$
X..
X.bp
X.NH 1
Changes and Modifications
X.PP
This is a summary of the major differences between
the new Line Printer Spooler and older Berkeley editions.
X.NH 2
Access Permissions
X.PP
All access is done using the printer_perms file.
This checks for both remote hosts and users on remote hosts.
Access permissions are divided in Control and Printing.
Remote users with control permissions on a queue can do just about
anything to the queue.
XEliminates the need for ROOT to do all the queue management.
X.NH 2
Printcap Extensions
X.PP
The
X.B fx
X(format check)
string allows a site to do checking to see if formats
are allowed on a printer. This can be specially useful for remote printers
by restricting certain certain formats.
X.NH 2
Prefilters
X.PP
This allows a local site to preprocess all the files at the local site,
and produce a single spool file for later use.
This is handy when using a remote printer.
As a special case,
the \-p option of LPR is processed at the local site.
X.NH 2
XFilter Parameters
X.PP
The filter parameters have been rationalized into a single set.
All options now have the form
X.IR -Fvalue ,
making life a little easier for the filter writer.
Also, additional paramters
X.L "\-Jjobname" ,
X.L "\-Cclass" ,
X.L "\-Fformat" ,
X.L "\-Zzopts" ,
etc,
are passed to filters.
X.NH 2
LPQ Information
X.PP
Greatly enhanced information.
The time a job has started has been added to the status information.
This is rather useful to know.
X.NH 2
XFilter Timeouts
X.PP
A timeout facility has been added to some filters.
This helps when attempting to find out if a device has gone off
line, is out of paper, etc.
X.NH 2
Special Queue Handling
X.PP
The
X.B qh
X(queue handler)
entry in the printcap now allows specification of a handler
to be invoked for every job taken from the queue.
This is nice for systems which wish to use the spooler
facilities for handling jobs,
but not for doing the actual data transfer.
X.NH 2
Accounting
X.PP
Accounting information was reformatted,
to make it a little easier for other programs like
X.I awk
and
X.I sort
to be used.
END_OF_FILE
if test 2119 -ne `wc -c <'doc/PLP/12.t'`; then
    echo shar: \"'doc/PLP/12.t'\" unpacked with wrong size!
fi
# end of 'doc/PLP/12.t'
fi
if test -f 'doc/PLP/announce' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'doc/PLP/announce'\"
else
echo shar: Extracting \"'doc/PLP/announce'\" \(2490 characters\)
sed "s/^X//" >'doc/PLP/announce' <<'END_OF_FILE'
X.ig
X$Header: 00.t,v 1.1 88/05/21 18:39:29 papowell Locked $
X$log$
X..
X.RP
X.EH 'PLP-%''PLP Manual'
X.OH 'PLP Manual''PLP-%'
X.nr CW 2.85i
X.nr GW .3i
X.TL
PLP \- The Public Line Printer Spooler
X.br
A Portable UNIX Line Printer Spooler
X.br
Release 2.0, 1 June 1988
X.AU
Prof. Patrick Powell
X.AI
Dept. of Computer Science
University of Minnesota, Minneapolis, Minnesota
X.PP
X.FS
X* UNIX is a trademark of ATT Bell Laboratories.
X.FE
X.PP
PLP is a reverse engineered version of the Berkeley LPD software.
The functional resemblance between PLP and the
Berkeley Line Printer Spooler (LPD) is intentional;
the source code was written without reference to the
original Berkeley LPD software,
except for some very small sections concerned with networking and the
large characters used for banner printing.
The PLP software has the following features:
X.IP 1). 5
The PLP software is intended to be  used in a Networked File System
X(NFS) environment,
in which there is a common set of spool queues,
as well as in a loosely coupled environment in which each host
transfers print jobs to a host which has the printer.
X.IP 2). 5
Access and permission to use
PLP functions is controlled by entries in a printer permissions file
X.I (/usr/spool/lpd/printer_perms.<hostname>)
which can restrict use by user name,
host,
spooler,
page useage,
and a host of other factors.
The printcap file
X.I (/usr/spool/lpd/printcap.<hostname>)
is used to specify the printer queues and their operation.
X.IP 3). 5
Jobs can now be prioritized.
The maximum priority a user can specify is set in the
printer permissions file.
X.IP 4). 5
In addition to the general printer permissions file,
each spool queue can have its own addition printer permissions file.
X.IP 5). 5
Line printer control functions can be exercised from a remote host.
Hosts and users with 
X.I "remote control permission"
are specified by entries in the printer permissions file.
X.IP 6). 5
Unspooling of jobs can be performed by a printcap specified program,
rather than by the PLP unspooler.
This allows PLP to be used as a spooler
and to have spool queues used for various purposes.
X.IP 7). 5
XExtremely verbose and chatty error messages have been added.
These greatly ease debugging and installation.
In addition,
the
X.I checkpc
utility can be used to set file permissions and other items for
use by the PLP software.
X.IP 8). 5
The code is quite portable,
with as few system dependencies in it as possible.
It has run on a VAX 4.2, 4.3, and ULTRIX,
SUN 3.0,
and
DG-UX.
END_OF_FILE
if test 2490 -ne `wc -c <'doc/PLP/announce'`; then
    echo shar: \"'doc/PLP/announce'\" unpacked with wrong size!
fi
# end of 'doc/PLP/announce'
fi
if test -f 'filters/compat.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'filters/compat.c'\"
else
echo shar: Extracting \"'filters/compat.c'\" \(2688 characters\)
sed "s/^X//" >'filters/compat.c' <<'END_OF_FILE'
X/*
X * COMPAT: a selected set of parameters are passed to the specified file
X * in order to be compatible.  This filter is called with the regular
X * parameters, but will only pass the specified subset.
X * Compat is called with:
X * ..../compat /.../filter [usual options]
X *  OF: filter      -wwidth -llength
X *  IF: filter [-c] -wwidth -llength -iindent -n login -h host accounting_file
X *  ?F: filter      -xwidth -ylength          -n login -h host accounting_file
X */
X
X#include <stdio.h>
extern errno;
char *width, *length, *xwidth, *ylength, *indent, *login, *host, *af, *cflag;
char *debug;
int format;
char *file;
char *newvec[20];
X
main( argc, argv )
X	int argc;
X	char **argv;
X{
X	int i;
X	char *arg;
X
X	newvec[0] = argv[1];
X	for( i = 2; i < argc; ++i ){
X		arg = argv[i];
X		if( arg[0] == '-' ){
X			switch( arg[1] ){
X			case 'w': width = arg; break;
X			case 'l': length = arg; break;
X			case 'x': xwidth = arg; break;
X			case 'y': ylength = arg; break;
X			case 'i': indent = arg; break;
X			case 'c': cflag = arg; break;
X			case 'F': format = arg[2]; break;
X			case 'h': host = arg+2; break;
X			case 'n': login = arg+2; break;
X			case 'D': debug = arg+2; break;
X			}
X		} else {
X			af = arg;
X		}
X	}
X	switch( format ){
X	/*
X	 *  OF: filter      -wwidth -llength
X	 */
X	case 'o':
X		if( width == 0 || length == 0 ){
X			fprintf( stderr, "%s: OF- missing one of -w, -l\n", argv[0] );
X			exit( 2 );
X		}
X		i = 1;
X		newvec[i++] = width;
X		newvec[i++] = length;
X		break;
X	/*
X	 *  IF: filter [-c] -wwidth -llength -iindent -n login -h host af
X	 */
X	case 'i':
X		if( width == 0 || length == 0
X			|| login == 0 || host == 0 ){
X			fprintf(stderr,"%s: IF- missing one of -w, -l, -n, -h\n",argv[0]);
X			exit( 2 );
X		}
X		if( indent == 0 ){
X			indent = "-i0";
X		}
X		i = 1;
X		if( cflag ){
X			newvec[i++] = cflag;
X		}
X		newvec[i++] = width;
X		newvec[i++] = length;
X		newvec[i++] = indent;
X		newvec[i++] = "-n";
X		newvec[i++] = login;
X		newvec[i++] = "-h";
X		newvec[i++] = host;
X		newvec[i++] = af;
X		break;
X	/*
X	 *  ?F: filter      -xwidth -ylength          -n login -h host af
X	 */
X	default:
X		if( xwidth == 0 || ylength == 0
X			|| login == 0 || host == 0 ){
X			fprintf(stderr,"%s: %cF- missing one of -x, -y, -n, -h\n", argv[0],
X				format);
X			exit( 2 );
X		}
X		i = 1;
X		newvec[i++] = xwidth;
X		newvec[i++] = ylength;
X		newvec[i++] = "-n";
X		newvec[i++] = login;
X		newvec[i++] = "-h";
X		newvec[i++] = host;
X		newvec[i++] = af;
X		break;
X	}
X	if( debug ){
X		for(i = 0; newvec[i]; ++i ){
X			fprintf(stderr, "%s ", newvec[i] );
X		}
X		putc( '\n', stderr );
X		fflush(stderr);
X	}
X	execv( newvec[0], newvec );
X	i = errno;
X	fprintf( stderr, "%s: execv failed (errno %d)", argv[0], errno);
X	errno = i;
X	perror( " " );
X}
END_OF_FILE
if test 2688 -ne `wc -c <'filters/compat.c'`; then
    echo shar: \"'filters/compat.c'\" unpacked with wrong size!
fi
# end of 'filters/compat.c'
fi
if test -f 'man/checkpc.1' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'man/checkpc.1'\"
else
echo shar: Extracting \"'man/checkpc.1'\" \(1987 characters\)
sed "s/^X//" >'man/checkpc.1' <<'END_OF_FILE'
X.TH CHECKPC 1 "19 Mar 1988" "U-MN PLP"
X.ig
X$Header: checkpc.1,v 2.1 88/05/09 10:08:23 papowell Exp $
X$Log:	checkpc.1,v $
Revision 2.1  88/05/09  10:08:23  papowell
PLP: Released Version
X
Revision 1.1  88/04/28  10:58:47  papowell
Initial revision
X
X..
X.SH NAME
checkpc \- check out the /etc/printcap database
X.SH SYNOPSIS
X.B checkpc
X[
X.B \-f
X] [
X.B \-l
X] [
X.B \-o
X] [
X.B \-a
X] [
printcap
X]
X.SH DESCRIPTION
X.B Checkpc
is used to check for the existence and correct permissions of entries
in the
X.I printcap
database,
which defaults to /etc/printcap.
It is useful when installing a new printcap database.
X.IP "\fB\-f\fI" 5
The fix flag will cause the checkpc program to try and fix
various files and permissions.
It does this in a simple minded manner,
and the program may have to be run several times until all permissions
are correct.
X.IP "\fB\-l\fI" 5
Do not create log files if the fix option has been specified.
X.IP "\fB\-o\fI" 5
Create printer (lp) if the fix option has been specified;
default is not to create printer.
X.IP "\fB\-a\fI" 5
Do not create accounting files if the fix option has been specified.
X.SH "ANNOYING FEATURES"
If the
X.B \-f
X(fix)
option is specified and you do not run this as root,
it will complain,
but attempt to carry out the operations.
Usually the 
X.IR chown (5)
will fail,
but this is not serious.
If you are installing a test version of the PLP software,
do NOT run as root,
otherwise files will be owned by daemon and not accessible.
X.SH FILES
X.nf
X.ta \w'/usr/spool/*/cf*       'u
X/etc/printcap	printer capabilities data base
X/tmp/printcap	use this is -X is specified
X/usr/spool/*	directories used for spooling
X.fi
X.SH "SEE ALSO"
lpq(1),
lprm(1),
pr(1),
printcap(5),
lpc(8),
lpd(8),
X.br
X.I "PLP- The Public Line Printer Spooler" ,
Patrick Powell,
U. Minnesota.
X.fi
X.SH DIAGNOSTICS
Tons of them.
XExcrutiatingly verbose.
X.SH BUGS
Should fix things up in a single pass,
but I got lazy.
X.SH "AUTHOR"
Patrick Powell, U. Minnesota, Dept. of Computer Science.
END_OF_FILE
if test 1987 -ne `wc -c <'man/checkpc.1'`; then
    echo shar: \"'man/checkpc.1'\" unpacked with wrong size!
fi
# end of 'man/checkpc.1'
fi
if test -f 'man/pac.8' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'man/pac.8'\"
else
echo shar: Extracting \"'man/pac.8'\" \(2392 characters\)
sed "s/^X//" >'man/pac.8' <<'END_OF_FILE'
X.TH PAC 8 "19 Mar 1988" "U-MN PLP"
X.ig
X$Header: pac.8,v 2.1 88/05/09 10:08:49 papowell Exp $
X$Log:	pac.8,v $
Revision 2.1  88/05/09  10:08:49  papowell
PLP: Released Version
X
Revision 1.1  88/04/28  10:58:56  papowell
Initial revision
X
X..
X.SH NAME
pac \- printer/ploter accounting information
X.SH SYNOPSIS
X.B /etc/pac
X[
X.B \-Pprinter
X] [
X.B \-pprice
X] [
X.B \-a
X] [
X.B \-e
X] [
X.B \-s
X]
X.SH DESCRIPTION
X.I Pac
reads the printer/plotter accounting files, accumulating the number
of pages (the usual case) or feet (for raster devices)
of paper consumed by each user, and printing out
how much each user consumed in pages or feet and dollars.
X.IP \fB\-P\fIprinter\fR
Selects the printer.
If not specified,
the value of the environment variable
X.B PRINTER
is used,
and if it is not defined,
the default printer for the site.
X.IP \fB-p\fIprice\fP
The price per page to be used,
instead of the printcap
X.B co
X(cost) entry.
If none is specified,
the default price of $0.02 per page is used.
X.IP \fB\-a\fR
Accounting is done for all printers.
A cumulative summary of usage of all the entries will be printed.
X.IP \fB\-e\fR
Accounting is done for each printer entry in turn.
X.IP \fP\-s\fR
Summarize the accounting information in the summary accounting file.
Used with the
X.B \-a
or
X.B \-e
flag all the accounting information for each printer
can be done at once.
This option has the side effect of truncating the original file.
It copies the original file to a backup before
doing any action.
X.PP
The accounting file is specified in the printcap
X.B af
entry.
The summary accounting file has the
X.B .sum
suffix added.
X.SH FILES
X.ta 2i
printcap af entry
X.SH NOTES
The accounting information is generated by the various filters used by
the
X.I LPD
daemon.
XFor each user file they should write a line to the accounting file in the
following format.
X.RS
X.nf
user host pages format date
papowell umn-cs 10 C April 13 1988
X.RE
X.PP
The summary file will produce entries of the form:
X.RS
X.nf
user host pages format runs cost
papowell umn-cs 1320 17 32.00
X.RE
X.SH "SEE ALSO"
X.br
X.I "PLP - The Public Line Printer Spooler",
by
Patrick Powell,
University of Minnesota.
X.fi
X.SH "HISTORY"
X.PP
The PLP is a reverse engineered version of the Berkeley 4.3BSD Line Printer
Spooler.
It has many advanced features which are described in
X.I "PLP - The Public Line Printer Spooler"
by
Patrick Powell,
University of Minnesota.
END_OF_FILE
if test 2392 -ne `wc -c <'man/pac.8'`; then
    echo shar: \"'man/pac.8'\" unpacked with wrong size!
fi
# end of 'man/pac.8'
fi
if test -f 'man/printer.1' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'man/printer.1'\"
else
echo shar: Extracting \"'man/printer.1'\" \(2039 characters\)
sed "s/^X//" >'man/printer.1' <<'END_OF_FILE'
X.TH PRINTER 1 "19 Mar 1988" "U-MN PLP"
X.ig
X$Header: printer.1,v 2.2 88/05/20 23:26:34 papowell Locked $
X$Log:	printer.1,v $
Revision 2.2  88/05/20  23:26:34  papowell
Removed redundant information
X
Revision 2.1  88/05/09  10:08:58  papowell
PLP: Released Version
X
Revision 1.1  88/04/28  10:58:59  papowell
Initial revision
X
X..
X.SH NAME
Printer \- printers used in typesetting.
X.SH DESCRIPTION
Typeset material prepared with the interface to
X.IR troff (1)
provided by the
X.IR typeset (1)
command can be sent to these supported printer types:
X.PP
X.ta 5n +\w'\fIpostscript\fP   'u
X.nf
X	\fIdumb\fP	line printer, DevWriter, crt etc.
X	\fIversatec\fP	versatec V80, or Printronix printer
X	\fIimagen300\fP	medium quality laser printer
X	\fIpostscript\fP	the PostScript language
X.fi
X.PP
The Printronix printer emulates a 300-dots-per-inch Versatec printer using 
X180 dots per inch, giving a blown-up page image;
the usual 8.5 by 11.0 inch wide page will be printed as a 15 by 18 inch page.
It uses an impact matrix print head to produce images on the paper and can
print any output meant for the Imagen.
The Versatec is a raster based output device, and can be used for high
quality VLSI design plots.
X.PP
The imagen300 (300 dots/inch resolution) uses a dry toner thereby producing
a square sharp pixel(dot).
This produces clear aliasing in some glyph definitions.  There is no blurring
of characters and output definition is constant across the whole page.
X.PP
PostScript is a resolution independent page description language.
The most common printer at Minnesota is the Apple LaserWriter (300 dots/inch).
X.SH COST
All typesetting has a processing cost(overhead).
The cost per page of output varies depending on what device you are using.
Page quotas and other methods can be used to keep track of individual use,
and appropriate billing can be done.
X.SH AVAILABILITY
Most printers are available to all Unix systems on campus.  Please
consult
X.IR printers (1)
for the availability of printers on your particular machine.
X.SH "SEE ALSO"
printers(1)
END_OF_FILE
if test 2039 -ne `wc -c <'man/printer.1'`; then
    echo shar: \"'man/printer.1'\" unpacked with wrong size!
fi
# end of 'man/printer.1'
fi
if test -f 'man/printers.1' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'man/printers.1'\"
else
echo shar: Extracting \"'man/printers.1'\" \(2212 characters\)
sed "s/^X//" >'man/printers.1' <<'END_OF_FILE'
X.TH PRINTERS 1 "19 Mar 1988" "U-MN PLP"
X.ig
X$Header: printers.1,v 2.2 88/05/20 23:26:49 papowell Locked $
X$Log:	printers.1,v $
Revision 2.2  88/05/20  23:26:49  papowell
Removed redundant information
X
Revision 2.1  88/05/09  10:09:01  papowell
PLP: Released Version
X
Revision 1.1  88/04/28  10:59:01  papowell
Initial revision
X
X..
X.SH NAME
printers \- as used in the -Pxxx option in lpr(1), lpq(1), and lprm(1).
X.SH "THE REAL PRINTERS"
The command "lpc stat" will show you the printers on the machine
you are using,
as well as whether they are able to accept data for printing.
The following summarizes the printers available on various machines.
X.br
X------ Site Dependent Information -------------
X.br
X.LP
X.I <printerType>_<printerLocation>
is the format used in naming printers.
X.LP
X.TP 1.8i
X.B imagen
Imagen 8/300 laser printer in Lind 33.
X.br
X\fIAlternate names\fR: csi, i300
X.SH GENERIC PRINTER NAMES
Most sites have generic names for printers of various types which can be
used to refer to a convinient real printer of the same type.
This mapping is host specific and is given in the CONFIGURATION section below.
X.br
X.TP 1i
X.B lp
This is the default line printer for the commands
X.I lpr(1), lpq(1), and lprm(1)
when no printer is specified via the -Pxxx option.
X.TP
X.B imagen
The default Imagen 8/300 compatible laser printer.
X.TP
X.B printronix
The default Printronix type printer able to emulate a versatec.
X.TP
X.B versatec
The default Versatec type printer that can accept raster images.
X.br
Note that at some sites this is emulated by a Printronix.
X.SH CONFIGURATION
XFor each site, the printers corresponding to the generic names
X.I
lp, printronix, imagen,
X.R
and
X.I versatec
X.R
are given in parentheses.
X.tr ~ 
X.ta 2.25i 3.25i
X.TP 1i
X.B umn-cs
X.IR imagen ~(imagen_cs), "	~lp" ~(??),
X.SH FILES
X.br
X.nf
X/etc/printcap
X.fi
X.SH SEE ALSO
lpr(1),
lprm(1),
lpq(1),
lpc(8),
printcap(8).
X.br
X.SH "HISTORY"
X.PP
The PLP is a reverse engineered version of the Berkeley 4.3BSD Line Printer
Spooler,
done in 1988 at the University of Minnesota.
It has many advanced features which are described in
X.I "PLP - The Public Line Printer Spooler"
by
Patrick Powell,
Department of Computer Science,
University of Minnesota.
END_OF_FILE
if test 2212 -ne `wc -c <'man/printers.1'`; then
    echo shar: \"'man/printers.1'\" unpacked with wrong size!
fi
# end of 'man/printers.1'
fi
if test -f 'src/find_name.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'src/find_name.c'\"
else
echo shar: Extracting \"'src/find_name.c'\" \(2848 characters\)
sed "s/^X//" >'src/find_name.c' <<'END_OF_FILE'
X/***************************************************************************
X * U. Minnesota LPD Software * Copyright 1987, 1988, Patrick Powell
X ***************************************************************************
X * MODULE: find_name.c
X * manages the Parms[] array entries.  Used by sender and receiver
X * file transfer functions of LPD.
X * The Parms[] array is maintained as a sorted list.
X * Find_name( char *name ): search the Parm[].filename entries for a match.
X *	returns: index if found, -1 if not;
X * Add_name( char *name ): search the Parm[].filename entries for a match.
X *	if not found, add the entry.
X *	returns: index where found or created.
X ***************************************************************************
X * Revision History: Created Sun Mar 13 10:29:54 CST 1988
X * $Log:	find_name.c,v $
X * Revision 3.1  88/06/18  09:34:11  papowell
X * Version 3.0- Distributed Sat Jun 18 1988
X * 
X * Revision 2.1  88/05/09  10:08:05  papowell
X * PLP: Released Version
X * 
X * Revision 1.2  88/04/26  15:52:47  papowell
X * Fixed up a horribly silly bug in the add_files and File_name
X * routines;  sigh.  Would you believe an L (l) and a one (1) got mixed
X * up?
X * 
X * Revision 1.1  88/03/25  14:59:28  papowell
X * Initial revision
X * 
X ***************************************************************************/
X#ifndef lint
static char id_str1[] =
X	"$Header: find_name.c,v 3.1 88/06/18 09:34:11 papowell Exp $ PLP Copyright 1988 Patrick Powell";
X#endif lint
X#include "lp.h"
X
X/***************************************************************************
X * Find_name( char *name)
X * The Parms[] array is used to hold the names of data and control files
X * corresponding to a job.  The Find_name will look through the list for
X * the job.
X ***************************************************************************/
X
XFind_name( name )
X	char *name;
X{
X	int i, j;
X
X	j = -1;
X	for( i = 0; i < Parmcount; ++i ){
X		if( strcmp( Parms[i].filename, name) == 0 ){
X			j = i;
X			break;
X		}
X	}
X	if(Debug>6)log(XLOG_DEBUG,"Find_name: %s, entry %d", name, j );
X	return( j );
X}
X
X/***************************************************************************
X * Add_name(char *name)
X * Maintains the Parms[].filename entries in sorted order.
X * 1. See if in file. if it is, return index.
X * 2. If not,  you will find the entry where it should be inserted.
X * 3. Move all the entries up one position.
X * the job.
X ***************************************************************************/
X
int
Add_name( name )
X	char *name;
X{
X	int i;
X
X	if( (i = Find_name( name )) < 0 ){
X		if( Parmcount < MAXPARMS ){
X			i = Parmcount;
X			++Parmcount;
X			(void)bzero( (char *)&Parms[i], sizeof( struct parm ));
X			(void)strcpy(Parms[i].filename, name );
X		} else {
X			i = -1;
X		}
X	}
X	if(Debug>5)log(XLOG_DEBUG,"Add_name: %s, entry %d", name, i );
X	return( i );
X}
END_OF_FILE
if test 2848 -ne `wc -c <'src/find_name.c'`; then
    echo shar: \"'src/find_name.c'\" unpacked with wrong size!
fi
# end of 'src/find_name.c'
fi
if test -f 'src/getprinter.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'src/getprinter.c'\"
else
echo shar: Extracting \"'src/getprinter.c'\" \(3319 characters\)
sed "s/^X//" >'src/getprinter.c' <<'END_OF_FILE'
X/***************************************************************************
X * U. Minnesota LPD Software * Copyright 1987, 1988, Patrick Powell
X ***************************************************************************
X * MODULE: get_printer.c
X * gets the default printer value for a user job
X ***************************************************************************
X * Revision History: Created Mon Feb  1 12:31:23 CST 1988
X * $Log:	getprinter.c,v $
X * Revision 3.1  88/06/18  09:34:15  papowell
X * Version 3.0- Distributed Sat Jun 18 1988
X * 
X * Revision 2.1  88/05/09  10:08:11  papowell
X * PLP: Released Version
X * 
X * Revision 1.4  88/05/05  20:07:09  papowell
X * Minor changes to shut up lint.
X * 
X * Revision 1.3  88/03/25  14:59:31  papowell
X * Debugged Version:
X * 1. Added the PLP control file first transfer
X * 2. Checks for MX during file transfers
X * 3. Found and fixed a mysterious bug involving the SYSLOG facilities;
X * 	apparently they open files and then assume that they will stay
X * 	open.
X * 4. Made sure that stdin, stdout, stderr was available at all times.
X * 
X * Revision 1.2  88/03/05  15:02:02  papowell
X * Minor Corrections,  Lint Problems
X * 
X * Revision 1.1  88/03/01  11:08:26  papowell
X * Initial revision
X * 
X ***************************************************************************/
X#ifndef lint
static char id_str1[] =
X	"$Header: getprinter.c,v 3.1 88/06/18 09:34:15 papowell Exp $ PLP Copyright 1988 Patrick Powell";
X#endif lint
X
X#include "lp.h"
X/***************************************************************************
X * Get_Printer()
X * Get the Printer Name
X * 1. check for -P option
X * 2. check for PRINTER environment variable
X * 3. use first in printcap
X *
X ***************************************************************************/
Get_Printer(all)
X	int all;
X{
X	int i;
X
X	if( Printer == 0 ){
X		if( Printer = getenv( "PRINTER" ) ){
X			if(Debug>4)log(XLOG_DEBUG,
X				"Get_Printer: PRINTER environment var '%s'", Printer );
X		} else {
X			/* use the default, first in list */
X			Printer = First_printer();
X			if(Debug>4)log(XLOG_DEBUG,
X				"Get_Printer: First_printer '%s'", Printer );
X		}
X	}
X	if(Debug>4)log(XLOG_DEBUG,"Get_printer: using Printer %s",Printer);
X	if( all ){
X		i = Get_pc_entry(Printer, All_pc_vars, All_pc_len );
X	} else {
X		i = Get_pc_entry(Printer, Status_pc_vars, Status_pc_len );
X	}
X	if( i == 0 ){
X		Diemsg( "no printcap entry for printer %s", Printer );
X	}
X}
X
X/***************************************************************************
X * Diemsg( char *m1, *m2, ...)
X * print error message and die
X ***************************************************************************/
X/*VARARGS1*/
Diemsg(m1, m2, m3, m4, m5, m6)
X	char *m1;
X	int m2, m3, m4, m5, m6;
X{
X	(void)fprintf( stderr, "%s: Fatal error- ", Name );
X	(void)fprintf( stderr, m1, m2, m3, m4, m5, m6 );
X	(void)fprintf( stderr, "\n" );
X	cleanup();
X	exit(1);
X}
X/***************************************************************************
X * Warnmsg( char *m1, *m2, ...)
X * print warning message
X ***************************************************************************/
X/*VARARGS1*/
Warnmsg(m1, m2, m3, m4, m5, m6)
X	char *m1;
X	int m2, m3, m4, m5, m6;
X{
X	(void)fprintf( stderr, "%s: Warning- ", Name );
X	(void)fprintf( stderr, m1, m2, m3, m4, m5, m6 );
X	(void)fprintf( stderr, "\n" );
X}
END_OF_FILE
if test 3319 -ne `wc -c <'src/getprinter.c'`; then
    echo shar: \"'src/getprinter.c'\" unpacked with wrong size!
fi
# end of 'src/getprinter.c'
fi
if test -f 'src/lpr.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'src/lpr.h'\"
else
echo shar: Extracting \"'src/lpr.h'\" \(2756 characters\)
sed "s/^X//" >'src/lpr.h' <<'END_OF_FILE'
X/***************************************************************************
X * U. Minnesota LPD Software * Copyright 1987, 1988, Patrick Powell
X ***************************************************************************
X * MODULE: lpr.h
X * Header file for LPR Program
X ***************************************************************************
X * $Header: lpr.h,v 3.1 88/06/18 09:34:49 papowell Exp $
X * Revision History: Created Sat Jan 30 19:39:13 CST 1988
X * $Log:	lpr.h,v $
X * Revision 3.1  88/06/18  09:34:49  papowell
X * Version 3.0- Distributed Sat Jun 18 1988
X * 
X * Revision 2.2  88/05/29  13:10:14  papowell
X * Added Header string for RCS purposes
X * 
X * Revision 2.1  88/05/09  10:10:55  papowell
X * PLP: Released Version
X * 
X * Revision 1.3  88/05/05  20:09:02  papowell
X * Added a NOHEADER option that allows user to suppress banner
X * 
X * Revision 1.2  88/03/25  15:00:20  papowell
X * Debugged Version:
X * 1. Added the PLP control file first transfer
X * 2. Checks for MX during file transfers
X * 3. Found and fixed a mysterious bug involving the SYSLOG facilities;
X * 	apparently they open files and then assume that they will stay
X * 	open.
X * 4. Made sure that stdin, stdout, stderr was available at all times.
X * 
X * Revision 1.1  88/03/01  12:44:04  papowell
X * Initial revision
X * 
X ***************************************************************************/
X#include "lp.h"
X
extern int Format;		/* Job Format */
extern int Copies;		/* Number of Copies */
extern int Binary;		/* Binary files */
extern int Use_links;	/* Make a symbolic link to the file */
extern int Remove;		/* Remove file after spooling */
extern int Noheader;	/* No header is to be printed */
extern char **Temp_file;	/* Names of temp files */
extern int Temp_count;	/* current number of temp files */
extern int Temp_max;	/* maximum number of temp files */
extern int Exper;		/* use the Xpert version */
extern int Priority;	/* priority */
extern int Job_number;	/* job sequence number */
extern char *Add_temp();	/* add a file to the temporary list */
extern char *Get_tmp_data();	/* create a temporary data file name */
extern char *Get_home();	/* get the home directory */
extern char *Get_cf();		/* create a temporary control file name */
extern char *Make_cf();		/* rename the temporary control file as real  */
extern char *Read_stdin;	/* name of temp file holding stdin */
extern int Open_SD(); 	/* Open the file in the spool directory */
extern char *Filter_out;	/* name of temp file for filter output */
extern char *Copy_file();	/* copy file to a temp file */
extern char *Get_cwd();		/* get the current working directory */
extern char *Full_path();	/* get the full path from the CWD */
extern int Do_prefilter();	/* do prefilter and return length */
END_OF_FILE
if test 2756 -ne `wc -c <'src/lpr.h'`; then
    echo shar: \"'src/lpr.h'\" unpacked with wrong size!
fi
# end of 'src/lpr.h'
fi
if test -f 'src/lpr_global.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'src/lpr_global.c'\"
else
echo shar: Extracting \"'src/lpr_global.c'\" \(2069 characters\)
sed "s/^X//" >'src/lpr_global.c' <<'END_OF_FILE'
X/***************************************************************************
X * U. Minnesota LPD Software * Copyright 1987, 1988, Patrick Powell
X ***************************************************************************
X * MODULE: lpr_global.c
X * Globals for LPR Program
X ***************************************************************************
X * Revision History: Created Mon Jan 25 17:16:16 CST 1988
X * $Log:	lpr_global.c,v $
X * Revision 3.1  88/06/18  09:34:56  papowell
X * Version 3.0- Distributed Sat Jun 18 1988
X * 
X * Revision 2.1  88/05/09  10:09:16  papowell
X * PLP: Released Version
X * 
X * Revision 1.3  88/05/05  20:08:58  papowell
X * Added a NOHEADER option that allows user to suppress banner
X * 
X * Revision 1.2  88/03/25  15:00:32  papowell
X * Debugged Version:
X * 1. Added the PLP control file first transfer
X * 2. Checks for MX during file transfers
X * 3. Found and fixed a mysterious bug involving the SYSLOG facilities;
X * 	apparently they open files and then assume that they will stay
X * 	open.
X * 4. Made sure that stdin, stdout, stderr was available at all times.
X * 
X * Revision 1.1  88/03/01  11:08:47  papowell
X * Initial revision
X * 
X ***************************************************************************/
X#ifndef lint
static char id_str1[] =
X	"$Header: lpr_global.c,v 3.1 88/06/18 09:34:56 papowell Exp $ PLP Copyright 1988 Patrick Powell";
X#endif lint
X
X#include "lpr.h"
X
int Format;					/* Job Format */
int Copies;					/* Number of Copies */
int Binary;					/* Binary files */
int Remove;					/* Remove files after using */
int Use_links;				/* Make a symbolic link to the file */
char **Temp_file;			/* Names of temp files */
int Temp_count;				/* current number of temp files */
int Temp_max;				/* maximum number of temp files */
int Exper;					/* use the Xpert version */
int Priority;				/* job priority */
int Job_number;				/* job sequence number */
char *Read_stdin;			/* name of temp file holding stdin */
char *Filter_out;			/* name of temp file for filter output */
int Noheader;				/* No header is to be printed */
END_OF_FILE
if test 2069 -ne `wc -c <'src/lpr_global.c'`; then
    echo shar: \"'src/lpr_global.c'\" unpacked with wrong size!
fi
# end of 'src/lpr_global.c'
fi
if test -f 'src/startserver.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'src/startserver.c'\"
else
echo shar: Extracting \"'src/startserver.c'\" \(2442 characters\)
sed "s/^X//" >'src/startserver.c' <<'END_OF_FILE'
X/***************************************************************************
X * U. Minnesota LPD Software * Copyright 1987, 1988, Patrick Powell
X ***************************************************************************
X * MODULE: startserver.c
X * send a "start" message to the LPD server
X ***************************************************************************
X * Revision History: Created Sun Jan 24 06:32:54 CST 1988
X * $Log:	startserver.c,v $
X * Revision 3.1  88/06/18  09:35:52  papowell
X * Version 3.0- Distributed Sat Jun 18 1988
X * 
X * Revision 2.1  88/05/09  10:10:34  papowell
X * PLP: Released Version
X * 
X * Revision 1.3  88/04/06  12:13:02  papowell
X * Minor updates, changes in error message formats.
X * Elimination of the AF_UNIX connections, use AF_INET only.
X * Better error messages.
X * 
X * Revision 1.2  88/03/25  15:01:53  papowell
X * Debugged Version:
X * 1. Added the PLP control file first transfer
X * 2. Checks for MX during file transfers
X * 3. Found and fixed a mysterious bug involving the SYSLOG facilities;
X * 	apparently they open files and then assume that they will stay
X * 	open.
X * 4. Made sure that stdin, stdout, stderr was available at all times.
X * 
X * Revision 1.1  88/03/01  11:09:22  papowell
X * Initial revision
X * 
X ***************************************************************************/
X/***************************************************************************
X * Startserver()
X * This originally used to use the UNIX domain sockets,  but now uses the
X * AF_INET domain sockets.  The actual sending is done by calling
X * Remote_start,  after setting the RP (remote printer) and RM fields
X * appropriately.
X * 1. Save the RP and RM values.
X * 2. Set RP to Printer and RM to Host
X * 3. If you are running NW, start the remote one
X * 4. Send the start message.
X * 5. Restore RP and RM
X * 6. Return success indication
X ***************************************************************************/
X#ifndef lint
static char id_str1[] =
X	"$Header: startserver.c,v 3.1 88/06/18 09:35:52 papowell Exp $ PLP Copyright 1988 Patrick Powell";
X#endif lint
X#include "lp.h"
X
Startserver()
X{
X	char *old_RP, *old_RM;			/* original RP and RM values */
X
X	old_RP = RP;
X	old_RM = RM;
X
X	RP = Printer;
X	RM = Host;
X	if( NW ){
X		RP = old_RP;
X		RM = old_RM;
X	}
X	if( Remote_start() == 0 ){
X		logerr(XLOG_INFO,"Startserver: host '%s' server for '%s' not started",
X			Host, Printer);
X	}
X	RP = old_RP;
X	RM = old_RM;
X}
END_OF_FILE
if test 2442 -ne `wc -c <'src/startserver.c'`; then
    echo shar: \"'src/startserver.c'\" unpacked with wrong size!
fi
# end of 'src/startserver.c'
fi
if test -f 'src/termclear.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'src/termclear.c'\"
else
echo shar: Extracting \"'src/termclear.c'\" \(2708 characters\)
sed "s/^X//" >'src/termclear.c' <<'END_OF_FILE'
X/***************************************************************************
X * U. Minnesota LPD Software * Copyright 1987, 1988, Patrick Powell
X ***************************************************************************
X * MODULE: termclear.c
X ***************************************************************************
X * Revision History: Created Mon Feb  1 18:06:56 CST 1988
X * $Log:	termclear.c,v $
X * Revision 3.1  88/06/18  09:35:54  papowell
X * Version 3.0- Distributed Sat Jun 18 1988
X * 
X * Revision 2.1  88/05/09  10:10:38  papowell
X * PLP: Released Version
X * 
X * Revision 1.3  88/04/08  08:49:17  papowell
X * Added <sys/types.h>, <sgtty.h> to includes
X * 
X * Revision 1.2  88/03/11  19:29:41  papowell
X * Minor Changes, Updates
X * 
X * Revision 1.1  88/03/01  11:09:26  papowell
X * Initial revision
X * 
X ***************************************************************************/
X#ifndef lint
static char id_str1[] =
X	"$Header: termclear.c,v 3.1 88/06/18 09:35:54 papowell Exp $ PLP Copyright 1988 Patrick Powell";
X#endif lint
X
X/***************************************************************************
X * Term_clear()
X * 1. Do the initialization if neccessary
X * 2. clear the screen using the termcap information
X * This code was taken from "Screen Updating and Cursor Movement Optimization
X * A Library Package", by Ken. C. Arnold;  with 4.3BSD Release,
X * Programmers Reference Manual
X ***************************************************************************/
static int tinit_done;
static int is_term;
X
X#ifdef TERMCAP
X#include <stdio.h>
X#include <sys/types.h>
X#include <sgtty.h>
X#include <curses.h>
X
char *getenv();
extern int XLOG_INFO;
X/***************************************************************************
X * definitions for TERMCAP
X ***************************************************************************/
char bp[1024];
char xp[1024];
char *area = xp;
short ospeed;
struct sgttyb sbuf;
char *TI;
char *TE;
char *CL;
char *tgetstr();
X
pputs( c )
X	int c;
X{
X	putchar( c );
X}
X
X
Term_clear()
X{
X	char *sp;
X	if( tinit_done == 0 ){
X		tinit_done = 1;
X		/*
X		 * set things up
X		 */
X		if( isatty(0) && (sp = getenv( "TERM" )) != NULL ){
X			/* get the speed */
X			if( ioctl(1, TIOCGETP, &sbuf) < 0 ){
X				logerr_die( XLOG_INFO,"ioctl on output failed" );
X			}
X			ospeed = sbuf.sg_ospeed;
X			if( tgetent( bp, sp ) > 0 ){
X				TI = tgetstr( "ti", &area );
X				TE = tgetstr( "te", &area );
X				CL = tgetstr( "cl", &area );
X			}
X			if( TI ){
X				tputs( TI, 0, pputs );
X			}
X			is_term = 1;
X		}
X	}
X	if( is_term && CL ){
X		tputs( CL, 0, pputs );
X	}
X}
X
Term_finish()
X{
X	if( is_term && TE ){
X			tputs( TE, 0, pputs );
X	}
X}
X#else TERMCAP
Term_clear()
X{ ; }
Term_finish()
X{ ; }
X#endif TERMCAP
END_OF_FILE
if test 2708 -ne `wc -c <'src/termclear.c'`; then
    echo shar: \"'src/termclear.c'\" unpacked with wrong size!
fi
# end of 'src/termclear.c'
fi
if test -f 'utilities/cpr/cpr.1' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'utilities/cpr/cpr.1'\"
else
echo shar: Extracting \"'utilities/cpr/cpr.1'\" \(3315 characters\)
sed "s/^X//" >'utilities/cpr/cpr.1' <<'END_OF_FILE'
X.TH CPR PUBLIC UW 
X.SH "NAME"
cpr  \-  print 'C' files
X.SH "SYNOPSIS"
X.B public cpr
X[ -l # ] [ -n ] [ -r[n] ] [ -s ] [-t tabwidth] [-p proportion]
X[ file ] ...
X.SH "DESCRIPTION"
X.I Cpr
prints the files named in its argument list, preceding
the output with a table of contents. Each file is assumed to be C
source code (but doesn't have to be) in that the program searches
for the beginning and end of functions. Function names are added to
the table of contents, provided the name starts at the beginning of
a line. The function name in the output is double struck.
X.PP
By default, blank lines are inserted after every closing '}'
character. Thus functions and structure declarations are nicely
isolated in the output. The only drawback to this is that structure
initialization tables sometimes produce lots of white space.
The \fB\-r\fP[n] option changes the space left to the specified
number of lines.  If no number is specified, no space is left.
X.PP
The option \fB\-l\fP indicates that the following argument is to be
the page length used for output, rather
than the default 66 lines (changing the page length hasn't been
tested much).
X.PP
The option \fB\-s\fP indicates that the table of contents should be sorted
by function name within each file.
X.PP
The option \fB\-n\fP indicates that output lines should be numbered with
the corresponding line number from the input file.
X.PP
The option \fB\-t\fI\ tabwidth\fR
causes output to be produced that will look correct with tabs expanded every
X.I tabwith
columns.
X(The default is every 8 columns.)
A
X.I tabwidth
of zero suppresses use of tabs; all output will be spaced using blanks.
X.PP
The option
X.B -p proportion
indicates what proportion of the page in steps of 16
should be used for deciding if a new function needs a new page.
That is -p12 (the default) indicates that if a function starts
within the top 12/16 (3/4) of the page then do it, otherwise put it
on a new page.
Thus the higher the number (up to 16) the closer to
the bottom of the page will functions be started.
X.B -p0
says put each function on a new page.
X.SH "FILES"
X.nf
X/tmp/cpr$$		\- temp files holding text
X.fi
X.SH "SEE ALSO"
cb(1), cat(1), fold(1), num(1), pr(1)
X.SH "DIAGNOSTICS"
Various messages about being unable to open files.
Self explanatory.
X.SH "BUGS"
This program is
unable to find function names that do not begin at the left margin.
It sometimes thinks some declarations are functions.
Use of macros to define functions will also confuse it.
Comments are not recognized, and #ifdef's are not processed,
so stuff inside them gets interpreted.
If the same function definition appears multiple times on the same page,
only one entry is made in the table of contents, to reduce the number
of redundant entries.
X.SH "AUTHOR"
X.nf
X.ta 3i
Paul Breslin\toriginal
Human Computing Resources Corp.
X.sp 0.5v
Rick Wise\tsorting, and use of standard input
CALCULON Corp.
X.sp 0.5v
David Wasley\tnumbering, times, etc.
U. C. Berkley.
X.sp 0.5v
Patrick Powell\tvariable number of lines between functions
University of Waterloo
X.sp 0.5v
Ian! D. Allen\tvariable tabs; redundant TOC suppression
University of Waterloo
X.sp 0.5v
Dennis Vadura\t-p option, better function recognition
University of Waterloo
X.fi
X.SH SUPPORT
This software is
X.I not
supported by
anybody.
Public Domain.
Caveat Emptor.
END_OF_FILE
if test 3315 -ne `wc -c <'utilities/cpr/cpr.1'`; then
    echo shar: \"'utilities/cpr/cpr.1'\" unpacked with wrong size!
fi
# end of 'utilities/cpr/cpr.1'
fi
echo shar: End of archive 2 \(of 16\).
cp /dev/null ark2isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 16 archives.
    rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0

-- 
Please send comp.sources.unix-related mail to rsalz at uunet.uu.net.



More information about the Comp.sources.unix mailing list