> From [EMAIL PROTECTED] Mon Jul 19 11:17:40 2004
> Date: Mon, 19 Jul 2004 18:16:34 +0200
> To: [EMAIL PROTECTED]
> Subject: LPRng: problem with as/ae in printcap
> From: Jerome Alet <[EMAIL PROTECTED]>
>
> Hi there,
>
> from an accounting filter launched with as and/or ae in printcap 
> file, I'd like to know what is the correct way to access to the 
> job's datas 
>
> I've done some testing, and I used to have the HF environment 
> variable contain df_name=name_of_data_file, but now I don't have it 
> anymore and it seems HF now contains an "encrypted" list of data 
> files (seperated by Ctrl+A and Ctrl+B characters, instead of a 
> single one, and in a different HF variable. 
>
> I don't remeber having changed anything and the (single) file 
> printed is the same, so I'd like to know what is the "always" 
> correct way to, from an accounting script, access to the job's data 
> file(s) contents. 
>
> thanks in advance for any answer
>
> Jerome Alet
>

I am making sure that the 'DATAFILES' environment variable that will
contain
the names of the datafiles, relative to the current directory,
i.e. - the spool directory.  These will be a whitespace separated
list of files.

This will be in the next release - actually I am just testing
this right now.

Comments:

The :as  (accounting start) and :ae (accounting end)
are called BEFORE processing any of the print jobs.

You can assume the following:

CF is the image of the 'Job Ticket' file (Ummm... used to be
called the 'hold file'... :-)

The 'hfdatafiles' is the list of data files to be printed.
These are ^A separated entries, one per 'file to be printed'.

Note that you could have: lpr f1 f1 f1

hfdatafiles=<entry for f1>^A<entry for f1>^A<entry for f1>^A

OR you could do:  lpr -C3 f1 and have
hfdatafiles=<entry for f1, copies = 3>^A

It is very confusing :-)

Each entry is a list of key=value pairs, with
 'transfername' = use this if no openname

So, you can try the following PERL code:

my $HF = $ENV{CF};
my $entries = {};

my @list = split( "\n", $HF );
foreach my $line (@list){
        my ($key,$value) = split( '=', $line, 2 );
        $entries->{$key} = $value;
}

my $hfdatafiles = $entries->{hfdatafiles};

my $datafiles = [];
@list = split("\001",$hfdatafiles);
foreach my $line (@list){
        my @fields = split("\002",$line);
        my $info = {};
        foreach my $pair (@fields){
                my ($key,$value) = split( '=', $line, 2 );
                $info->{$key} = $value;
        }
        push @{$datafiles}, $info;
}

# $datafiles is now an array of hash information.  You can get
# a list of the files by doing:

my @files = map { $_->{transfername} } @list;

Ummm... note that this may cause duplicate entries.
 For example:  lpr f1 f2 f1 f2 will result in ("f1", "f2", "f1", "f2")



-----------------------------------------------------------------------------
YOU MUST BE A LIST MEMBER IN ORDER TO POST TO THE LPRng MAILING LIST
The address you post from or your Reply-To address 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.
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,  call Patrick Powell or one of the friendly
staff at Astart Technologies for help.  Astart also does support for LPRng.
Also, check the Web Page at: http://www.lprng.com for any announcements.
Astart Technologies  (LPRng - Print Spooler http://www.lprng.com)
6741 Convoy Court
San Diego, CA 92111
858-874-6543 FAX 858-751-2435
-----------------------------------------------------------------------------

Reply via email to