> From [EMAIL PROTECTED] Tue Apr 20 04:50:18 2004
> To: <[EMAIL PROTECTED]>
> Subject: =?iso-8859-1?Q?Re:_LPRng:_Fixing_a_Windows_bug_with_LPRng??=
> From: <[EMAIL PROTECTED]>
> Date: Tue, 20 Apr 2004 12:56:01 +0200
>
>
> Hi!
>
> Since I was curious, I figured I could use the information from this
> thread to try to program my own solution to my problem, as it seems
> that the next release of LPRng might still take some time to come out.
> In attempting to do this, I stumbled over the following issue:
>
> >From http://www.lprng.com/LPRng-Reference/LPRng-Reference.html:
> ---snip---
> 4.2. Sample Printcap Entry
> [...]
> Here is another example of a printcap entry using the %P notation:
>
> lp:[EMAIL PROTECTED]
>
> This entry will cause all jobs sent to the lp spool queue to be sent to
> the lp queue on server. %X strings in the printcap entries are expanded
> as shown:
> Key Replaced By
> %P printcap entry primary name (printer)
> %Q queue requested
> [...]
> ---snip---
>
> To verify this, I did the following (including checkpc -fV to make sure
> the dirs/perms are OK):
>
> printcap:
> bar|foo|*:\
> :lp=/dev/null:\
> :sd=/var/spool/lpd/foo:\
> :if=/usr/local/bin/test.pl %P %Q:\
> :la@:mx#0:\
>
> test.pl:
> #!/usr/bin/perl
> $foo=`logger "test.pl has been called: @ARGV"`;
>
> result in /var/log/messages (anonymized):
> Apr 20 xx:xx:xx xxxxxxxxxx logger: test.pl has been called:
> foo [EMAIL PROTECTED] -CA -Dxxxx-xx-xx-xx:xx:xx.xxx -Ff
> -Hxxxxxxxxxx.xxxx.xxxx -J/etc/samba/smb.conf -Lroot
> -N/etc/samba/smb.conf -Pfoo -Qfoobar -aacct -b5402
> -d/var/spool/lpd/foo -edfA644xxxxxxxxxx.xxxx.xxxx
> -f/etc/samba/smb.conf -hxxxxxxxxxx.xxxx.xxxx -j644
> -kcfA644xxxxxxxxxx.xxxx.xxxx -l66 -nroot -sstatus
> -txxxx-xx-xx-xx:xx:xx.xxx -w80 -x0 -y0 acct
>
> What happened to %Q? Of course, seeing the output of @ARGV, I figured
> that I can simply grep for -Q, but still I was wondering if I am
> misunderstanding the documentation or if something is wrong here.
>
> Patrick?
>
> Kind Regards,
> Stefan Baur
It appears that there is a fault in the documentation. The %P and %Q
are expanded at the time the printcap is read. The
$Q and $P expanded at the time the control file for job to be printed is
read. Thus, %P and %Q are useful for INCOMING jobs, and on a queue basis,
while $P and $Q are for OUTGOING jobs, and on an individual job basis.
I know I must have had some reason for doing it this way, but I cannot
remeber the actual details.
For example, if you have
bar|foo|*:[EMAIL PROTECTED]
Then you would always have the jobs spooled to %P
If you have:
bar|*:[EMAIL PROTECTED]
then you would have the jobs spooled to the queuename at localhost:
lpr -Ptestqueue would get jobs sent to [EMAIL PROTECTED]
But when the jobs are processed in the queue, then the filter gets the
information from the actual job file:
bar|foo|*:\
:lp=/dev/null:\
:sd=/var/spool/lpd/foo:\
:if=/usr/local/bin/test.pl %P %Q:\
:la@:mx#0:\
#!/bin/sh
echo $0 $@ >/tmp/a
printenv >>/tmp/a
After doing: lpr /tmp/hi
I have:
more /tmp/a
/var/tmp/LPD/test.pl bar bar [EMAIL PROTECTED] -CA -D2004-04-27-12:54:17.639 \
%P %Q
-Ff -Hh110.private -J/tmp/hi -Lpapowell -N/tmp/hi -Pbar -Qbar -aacct -b3 \
$P $Q
-d/var/tmp/LPD/bar -edfA019h110.private -f/tmp/hi -hh110.private -j019 \
-kcfA019h110.private -l66 -npapowell -sstatus -t2004-04-27-12:54:17.000 -w80 -x0
-y0 acct
USER=papowell
LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib
HOME=/home/papowell
PRINTCAP_ENTRY=bar|foo|*
:if=/var/tmp/LPD/test.pl bar bar
:la@
:lp=/dev/null
:mx#0
:sd=/var/tmp/LPD/bar
...
Note the 'test.pl bar bar'
Now if I do: lpr -Pthisisatest /tmp/hi
I get:
/var/tmp/LPD/test.pl bar bar [EMAIL PROTECTED] -CA -D2004-04-27-12:56:50.244
-Ff -Hh110.private -J/tmp/hi -Lpapowell -N/tmp/hi -Pbar -Qthisisatest -aacct -b3
$P $Q
-d/var/tmp/LPD/bar -edfA046h110.private -f/tmp/hi -hh110.private -j046
-kcfA046h110.private -l66 -npapowell -sstatus -t2004-04-27-12:56:50.000 -w80 -x0
-y0 acct
USER=papowell
LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib
HOME=/home/papowell
PRINTCAP_ENTRY=bar|foo|*
:if=/var/tmp/LPD/test.pl bar thisisatest
:la@
:lp=/dev/null
:mx#0
:sd=/var/tmp/LPD/bar
I hope this helps.
Patrick Powell Astart Technologies
[EMAIL PROTECTED] 6741 Convoy Court
Network and System San Diego, CA 92111
Consulting 858-874-6543 FAX 858-751-2435
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.
-----------------------------------------------------------------------------