> From [EMAIL PROTECTED] Fri Aug 18 00:17:44 2000
> From: "Blom, Wayne" <[EMAIL PROTECTED]>
> To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
> Subject: RE: LPRng: lpq hangs system
> Date: Fri, 18 Aug 2000 15:51:34 +0930
>
> How about the question. Is there anyway to direct output from a print queue
> to a directory?
>

Oh,  sorry,  I missed that.

Yes.  You have your choice of sending to a file (concatenate)
or simply putting them into a directory.

The simplest way to have them sent to a file is:

lp:lp=/path_to_file
  :sd=/...

Now if you simply want them LEFT in the directory and handled
in some other way, you use:

lp:lp=/dev/null
  :sd=/...
  :of=/path_to_handler
  :filter=/path_to_junker


#/bin/junker
exit 0

The 'junker' is there just to make lprng happy.
The 'handler' program is a filter that gets all of the job
information including all of the data file names, control file
image, etc., and simply carries out its work.

Note that it must read from STDIN and look for the '\031\001' sequence
and then suspend itself to be compatible with the OF filter requirements.
You can do this by the following trivial loop:

 static char stop[] = "\031\001";    /* sent to cause filter to suspend */

    state = 0;
    while( (n = read(0,inbuf,1)) > 0 ){   
        if( inbuf[0] == stop[state] ){
            ++state;
            if( stop[state] == 0 ){
                kill( getpid(), SIGSTOP);
            }
                        state = 0;
            continue;
        } else if( state ){
            state = 0;
            if( write(1,stop,1) != 1 ){
                Errorcode = JABORT;
                LOGERR_DIE("Process_OF_mode: write failed");
            }
        }
        if( write(1,inbuf,1) != 1 ){
            Errorcode = JABORT;
            LOGERR_DIE("Process_OF_mode: write failed");
        }
    }
    if( state && write(1,stop,1) != 1 ){
        Errorcode = JABORT;
        LOGERR_DIE("Process_OF_mode: write failed");
    }


You can also use PERL with the same logic.


Patrick Powell                 Astart Technologies,
[EMAIL PROTECTED]            9475 Chesapeake Drive, Suite D,
Network and System             San Diego, CA 92123
  Consulting                   858-874-6543 FAX 858-279-8424 
LPRng - Print Spooler (http://www.astart.com)

-----------------------------------------------------------------------------
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.
-----------------------------------------------------------------------------

Reply via email to