[cups.general] Printing multiple copies when file comes from stdin?

Steve Bergman steve at rueb.com
Thu Mar 3 14:11:43 PST 2005


It seems that the "lpr -#" and  "lp -n" options do not work when the 
input file to lp/lpr comes from stdin.

i.e. ls  -l | lp -n2

only prints one copy.  Looking into the matter, I notice that the 
backend gets called differently depending upon how lp/lpr was called.  
in the above example, the backend gets called with 6 arguments and takes 
its input from stdin.

However,

lp -n3 /etc/inittab

results in the backend being called with an extra argument which is the 
file name.

The problem, if I am reading the code of the backend correctly, is that 
to do multiple copies, it reads the file, lseeks back to the beginning 
and then writes it out again.  stdin can't be lseeked back to 0 so you 
only get 1 copy.

This all seems quite odd, as when lp takes its input from stdin, a spool 
file still get's created in the /var/spool/cups directory.  Why does the 
backend get called in such a way that the "-n" option, which is a 
documented option, does not work?

Any help greatly appreciated.

Thanks,
Steve Bergman





More information about the cups mailing list