Subject: Re: [netatalk-admins] Idea for Net printing but i need help....

From: "ian reinhart geiser" <[email-masked]>
Date: Sun, 24 Jan 1999 19:18:00 -0600

Okay...
    here is what i have:

    i wrote my script that takes in standard in and will convert it to a
    pdf file in the tmp dir.

    my problem is that i cannot get the information there....

    dose anyone know how to set up the papd.conf file so that i can
    execute the shell script.  mine currently is this:

    nerd:\
        :pr=/etc/atalk/testpr.sh\
        :op=geiseri:

    my testpr.sh is as follows:

        #!/bin/sh
        convert $1 /tmp/foo.pdf

    it works when i send testpr.sh junk from stdin but when i use the pap it
    dumps core...

    am i going in the wrong direction.

    -ian reinhart geiser

---

From: Kadinger Andras <[email-masked]>
Date: Mon, 25 Jan 1999 02:48:40 +0100 (CET)

Hello Ian,

>         :pr=/etc/atalk/testpr.sh\

Oops, a '|' is missing I think. It should read:

pr=|/etc/atalk/testpr.sh

'|' is an undocumented way to tell papd you don't want to send
data to an lpr printer named '/etc/atalk/testpr.sh' but you want to pipe
the data into the program '/etc/atalk/testpr.sh'.

>     it works when i send testpr.sh junk from stdin but when i use the pap it

Hmm, that's not nice, but I think happens because of this.

>     am i going in the wrong direction.

No, you just missed a step. :)

Regards,
Andras Kadinger
[email-masked]

---

From: Albert Max Lai <[email-masked]>
Date: Mon, 25 Jan 1999 05:45:17 -0500 (EST)

>         :pr=/etc/atalk/testpr.sh\

Here's  your problem, you should pipe it to a script like this:

     nerd:\
         :pr=|/etc/atalk/process_ps.pl\
         :op=geiseri:

I recommend using perl roughly like this:

#!/bin/perl -w
@infile = <STDIN>;
mkdir("/tmp/$$", 0755) || die "can't make directory ($!)";

# use some sort of an outfile name

open(OUTFILE_NAME,">/tmp/$$/".$outfile_name) ||   die "couldnt't open the
target file: $!\n";
print OUTFILE_NAME @infile;
close(OUTFILE_NAME);

This should come close to putting a postscript file in a temp directory.
After this you should then run your shell script on this file and then
remove the file and the enclosing directory.

--
Albert Lai <[email-masked]>           1018D East Campus
Residential Computer Consultant           411 W. 116th St.
Columbia University                       New York, NY 10027
http://www.columbia.edu/~aml61            (212)853-4854