[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lprng
Subject:    Re: LPRng: -J$-'J and -f$-'f printcap parameters
From:       Patrick Powell <papowell () astart ! com>
Date:       2002-04-25 2:06:48
[Download RAW message or body]

> From lprng@astart2.astart.com Wed Apr 24 10:56:58 2002
> Date: Wed, 24 Apr 2002 14:10:12 -0300
> From: Andreia Pio da Silva <andreia@ifi.unicamp.br>
> To: lprng@lprng.com
> 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,
papowell@astart.com            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 majordomo@lprng.com (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 majordomo@lprng.com
with:                           | example:
subscribe LIST <mailaddr>       |  subscribe lprng-digest myname@host.org
unsubscribe LIST <mailaddr>     |  unsubscribe lprng myname@host.org

If you have major problems,  send email to papowell@astart.com with the word
LPRNGLIST in the SUBJECT line.
-----------------------------------------------------------------------------
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic