> From [EMAIL PROTECTED] Wed Apr 24 10:56:58 2002
> Date: Wed, 24 Apr 2002 14:10:12 -0300
> From: Andreia Pio da Silva <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: LPRng: -J$-'J and -f$-'f printcap parameters
>
> Hi,
>
> I changed accounting.pl to have quota control. I have
> HP LaserJet 4 and this printer don't have pagecounter
> readable. Then I need count pages with my born shell program.
>
> How can I access STDIN of my command lpr ?
> or How can I access printer filename(dfA464eos.ifi.unicamp.br):
> processing 'dfA464eos.ifi.unicamp.br', size 677, format 'f', IF filter
> 'ifhp' at 2002-04-24-13:43:02.393 ## A=andreia@eos+464 number=464
> process=1436
>
> My printcap:
> lj4|lp
> :af=acct
> :as=|/usr/adm/quota/accounting.pl start -J$-'J -f$-'f -N$-'N
> :ae=|/usr/adm/quota/accounting.pl end -J$-'J -f$-'f -N$-'N
> :achk
> :cm=HP Laserjet 4
> :filter=/usr/local/libexec/filters/ifhp
> :ifhp=model=hp4,status@,sync,pagecount@,waitend@
> :lf=log
> :lp=/dev/lpt0
> :mx=0
> :rw@
> :sd=/var/spool/lpd/%P
> :sh
>
> The parameter -f$-'f is the same -J$-'J --> name of the file.
> I would you like:
> -J<name of file>
> -f<dfA....>
>
> thanks,
>
> -- 
> Andr�ia Pio da Silva
> ________________________________________________________________________
> Centro de Computa��o John David Rogers - CCJDR   voice: +55 19 3788.5306
> Instituto de F�sica Gleb Wataghin - IFGW - UNICAMP

You will have to write a 'wrapper' script:

#!/bin/sh
/.../program_to_get_page_counts $*
/usr/bin/perl -e 'rewind STDIN;'
/.../ifhp

The program_to_get_page_counts will have to read STDIN and
calculate the number of pages.  It should write the page count
information to the accounting file.

The perl script simply rewinds STDIN so that it is at
the start of file.  You can do this with the following C program
as well:

#include <unistd.h>
int main()
{
        lseek(0,0,SEEK_SET);
        exit(0);
}

Patrick Powell                 Astart Technologies,
[EMAIL PROTECTED]            9475 Chesapeake Drive, Suite D,
Network and System             San Diego, CA 92123
  Consulting                   858-874-6543 FAX 858-279-8424 
LPRng - Print Spooler (http://www.lprng.com)

-----------------------------------------------------------------------------
YOU MUST BE A LIST MEMBER IN ORDER TO POST TO THE LPRNG MAILING LIST
The address you post from MUST be your subscription address

If you need help, send email to [EMAIL PROTECTED] (or lprng-requests
or lprng-digest-requests) with the word 'help' in the body.  For the impatient,
to subscribe to a list with name LIST,  send mail to [EMAIL PROTECTED]
with:                           | example:
subscribe LIST <mailaddr>       |  subscribe lprng-digest [EMAIL PROTECTED]
unsubscribe LIST <mailaddr>     |  unsubscribe lprng [EMAIL PROTECTED]

If you have major problems,  send email to [EMAIL PROTECTED] with the word
LPRNGLIST in the SUBJECT line.
-----------------------------------------------------------------------------

Reply via email to