[comp.unix.admin] lpr input filter question

bshaw@hcmv2.ti.com (Bob Shaw) (06/27/91)

This may be a very basic question but ......

I am playing with input filters for lpr and one thing I need
is the know how the "file name" is passed.  

I have a need for this info but just don't know where it 
comes from .

I've printed out all of the arguments while in the filter
and even though the users name and host name is passed, the 
file name doesn't seem to be passed.  

On other scripts  it appears that argument 9 is used for
file name.

What am I missing?

Any comments / help will be appreciated.
Thanks in advance.


Bob Shaw 
bshaw@hcvdl.csc.ti.com

dbruce@bnr.ca (D. Bruce) (06/28/91)

In article <bshaw.678029530@hcmv2> bshaw@hcmv2.ti.com (Bob Shaw) writes:
>
>This may be a very basic question but ......
>
>I am playing with input filters for lpr and one thing I need
>is the know how the "file name" is passed.  
>

It isn't.

>I have a need for this info but just don't know where it 
>comes from .
>

  You can still get this information rather indirectly however.
Since 'lpd' changes to the spool directory you can examine the lock
file while you run your version of 'ipf'.  The lock file, 'lock' will
have two lines in it. The first line is the process id of the lock holder
the second line is the name of the control file.

i.e. something like this....

9866
cfA074hostname

  The contents of the control file will have the file name(s) encoded
as 'Nfilename'. As you can have multiple file names in this control file
you will have to keep track of each time 'ipf' is called.

  You could do this by keeping a file say 'job' updated with the control
file name, and the file number being printed.

  You should get a copy of the BSD 'lpd' sources, this will show
you what you have to do. You could modify the 'lpd' sources to pass
the filename. But if you don't want to modify your binaries....

>I've printed out all of the arguments while in the filter
>and even though the users name and host name is passed, the 
>file name doesn't seem to be passed.  
>

  I wish that some of the better features of SYSV and BSD when it
comes to printing would be combined. :-)

  BSD is easy to set up, one update to '/etc/printcap' instead of 
model this, class that, for SYSV. However, SYSV sure is nice when it comes
to configuring those shell script filters. The file name _is_ passed
under SYSV. :-)

-- 
D. Bruce                       Bell-Northern Research  |opinions expressed
dbruce@bnr.ca                  P.O. Box 3511, Stn. C   |are my own, and not
(or internally dbruce@bwdls1)  Ottawa, ON, CANADA      |necessarily BNRs