parallel printer use with lpr (?)

Kian-Tat Lim ktl at wag.caltech.edu
Wed Jun 5 18:15:19 AEST 1991


	We have a Tektronix Phaser II PX attached to one of our
Personal Irises, which serves it to our other systems via Berkeley
lpd.  The printcap entry follows:

color|colorps|Tektronix Phaser II PX:\
	:sh:sf:tr=^D:\
	:lp=/dev/plp:\
	:if=/usr/local/bin/cpsf:\
	:af=/usr/adm/lcd-acct:\
	:lf=/usr/adm/lcd-errs:\
	:sd=/usr/spool/lcd:

/usr/local/bin/cpsf is a short Perl script that does some accounting:

#!/usr/bin/perl

sub now {
    ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
    $str = sprintf("%02d/%02d %02d:%02d:%02d",$mon+1,$mday,$hour,$min,$sec);
    return $str;
}
	
do "getopts.pl";
&Getopts('w:l:i:n:h:');

$LOG = "STDERR";
($log = shift) && open(LOGOUT, ">>$log") && ($LOG = "LOGOUT");
warn "Couldn't open accounting file: $!" if ($log && $LOG ne "LOGOUT");

print $LOG "$opt_n@$opt_h " . &now;

while (<STDIN>) {
    $num += length;
    print;
}

print $LOG " $num" . "c " . &now . "\n";

close(LOGOUT) if $LOG eq "LOGOUT";
print STDOUT "\004";
-- 
Kian-Tat Lim (ktl at wag.caltech.edu, KTL @ CITCHEM.BITNET, GEnie: K.LIM1)
System Manager, Materials & Molecular Simulation Center, Caltech



More information about the Comp.sys.sgi mailing list