
			 LPTOOLS package

		  Copyright (c) 1993, Casper Maarbjerg

-------------------------------------------------------------------------------

	Permission is hereby granted to copy, reproduce, redistribute,
	or otherwise use this software as long as: there is no monetary
	profit gained specifically from the use or reproduction of this
	software, it is not sold, rented, traded or otherwise marketed,
	and this copyright notice is included prominently in any copy
	made.

	The author make no claims as to the fitness or correctness of
	this software for any use whatsoever, and it is provided as is. 
	Any use of this software is at the user's own risk.

-------------------------------------------------------------------------------

This package contains some tools for managing printer queues;

   lpstat	report problems with printer
   lpstat -v	verbose; report spooled files
   lpstat -c	verbose; report lpr commandline and control files
   lpstat -d	report stray datafiles (only names)

   lpkill -a
   lpkill job [job...]
   lpshut	stop printing, but don't touch files
   lpshed	restart printing

   lp [file...]	lpr filter script; it should be noted that the use
		of this command defeats most of the usefulness of
		the two first - it effectively hides both filename
		and commandline from lpr - so this info won't show.
		It is useful though, for printing files, that
		aren't readable by daemon - along with preventing 
		empty or unreadable files from letting lpr eject
		an empty page.

The three shell scripts can be run with their name indicating
what device to use (link or move lp* to hp* ...)
These scripts are in turn based on a C-program, supposed to run suid
to daemon. It should be described sufficiently in its header, so
i won't repeat the info here. Also, to save bandwidth, i only include
the source.
To install, modify the Makefile macros TOOLDIR and BINDIR to taste; 
BINDIR should be included in the $PATH variable for convenient access.
Then run make install.

Package contents:

rw-r--r-- 8/5   1460 May 11 13:17 1993 lptools/Makefile
rw-r--r-- 8/5   3723 May 11 20:50 1993 lptools/README
rwxr-xr-x 3/3    561 May  6 05:22 1993 lptools/lp
rw-r--r-- 8/5   6241 May 11 20:48 1993 lptools/lpx.c
rwxr-xr-x 3/3    788 May 11 20:02 1993 lptools/lpkill
rwxr-xr-x 3/3   1784 May 11 20:00 1993 lptools/lpstat

This package is based on lpstat.sh.Z, but finding it to have some 
shortcomings - first of all, calling awk twice per control file, slowing
the process significantly with just a few jobs - led me into this project.

So the next logical step was to write a compiled program, that could
be run suid to daemon, to do the job instead of awk - with only one
invocation. Having hacked a little with the control files, i found the
only reliable field to detect the file name by, was the line(s) marked 'A'.
But if the file has been spooled by lpr, this field contains only the
basename of the datafile, so in this case the contents of the first
line in the control file could be rather more informative: the actual 
commandline that spooled the job.
This made me make two variants of the program (links) to report either
queued filenames or commandlines.

During the test phase, i got accumulated so much garbage, that i found,
it might be convenient to have a program, that could selectively kill
spooled jobs by their number. 
As it is a setuid program, it verifies caller id before removing job.

And as the last item came the program to report daemon PID from lockfile
- or remove lock. (also depending on the name of the command)

                              - o -

Comments are welcome, but presently i'm not connected to usenet, so 
you will have to send mail to: umunk!dkate!casper .
