I am somewhat hesitant to manipulate files to try to get it to work as
the software I am writing needs to work unattended and robustly.
Finding some docs regarding all of this would be the best bet.
My hunch is that somehow lpd must be prodded to process a file,
thereby adding it to its queue. Again, my guess would be that just
adding a file to the spool directory would not be enough–though I
don’t know this for sure. And maybe, if it worked once, it might not
work another time.
I wonder if there is a lpd expert around somewhere?
Best to you,
Greg
On Thu, 15 Mar 2001 13:47:18 -0500, “Richard R. Kramer”
<rrkramer@kramer-smilko.com> wrote:
I don’t know enough about the internals of lpr/lpd to give an
authoritative answer. Looking at the black-box behavior of lpd,
however, it appears that lpd looks in usr/spool/lpd/<printer
for pairs of files named a certain way. One file is the job to be
printed, the other is some housekeeping info (I can guess at the
meaning of some of it; I bet there are docs somewhere in the world
that explain it). I would be inclined to experiment with simply
manipulating the lock and .seq files and writing the other two files
straight away.
Richard
Greg Laird wrote:
Hi Richard,
Thanks for your post. I am using the TCPIP print spooling routines so
I will not be using lpsrvr (though I like the idea of writing to
/dev/spool…). I also like your idea of spawning lpr and then
writing my data to a pipe. I think this is what I will do.
One question: I will generate a file for printing every few minutes
and would like the file to be spooled immediately after I have
completed writing it. The way I imagine this would work would be:
aa:
create pipe
spawn lpr and pass fd for read side of pipe
write my postscript data into write side of pipe
close my write side of the pipe when done with page
go to aa
I am guessing that lpr will not release the file to the spooler until
it reads and EOF on the file. The only way that I can send an EOF is
to close the writing end of the pipe.
When lpr receives an EOF, I also imagine that it will terminate so I
will have to respawn it for every file I write. I would be great to
not have to respawn this program repeatedly.
Any comments or ideas?
Thanks again,
Greg Laird
On Wed, 14 Mar 2001 20:36:37 -0500, “Richard R. Kramer”
rrkramer@kramer-smilko.com> > wrote:
You should be able to open a pipe, spwan lpr with “-P” and
“nec” args and write your file to the pipe.
If you also have lpsrvr running, there can be and entry in
/dev/spool/ that you can write to directly.
Richard
Greg Laird wrote:
Hello,
I am using QNX4.25 and have set up a remote printer using the TCPIP
based printer spooling system. I use lpr to print files. This all
works fine.
I have an application that generates postscript printer files and I
would like to spool these files from the application w/o the user
having to use lpr. I imagine that I could do this:
system(“lpr -P nec filename.ps”);
to print ‘filename.ps’ on the ‘nec’ printer. I was wondering if there
is a more elegant way to do this w/o calling a utility program. Maybe
I can send a message to a process or something?
If you have an idea and could point me in the direction of some
documentation that would be great!
Thanks for your time,
Greg Laird