custom print filters in spooler

How does one go about specifying a custom print filter in spooler?

I wrote a custom filter in perl, and it works great on the command line.
However, when I specify it in my custom spooler config file in place of
phs-to-ps, nothing prints. There are no error messages logged anywhere,
so I don’t know what’s going on.

Check the parameters. I have found the input file can be the SECOND
parameter (sometimes!!!) 6.2.0 & 6.2.1 (Nice and deterministic)

Roger Smith wrote:

How does one go about specifying a custom print filter in spooler?

I wrote a custom filter in perl, and it works great on the command line.
However, when I specify it in my custom spooler config file in place of
phs-to-ps, nothing prints. There are no error messages logged anywhere,
so I don’t know what’s going on.

Warren Deitch wrote:

Check the parameters. I have found the input file can be the SECOND
parameter (sometimes!!!) 6.2.0 & 6.2.1 (Nice and deterministic)

I ran spooler manually, with the -vvvv option, and I’m getting “errno 2”
whenver it tries to run my perl print filter. File not found? The file’s
right there…

Is the spooler complaining about the filter or the filter complaining
about the input file ?

Does the filter have execute permission ?

Execute a script instead of your filter. I dug up the old script that
helped me out !


#!/bin/ksh

Check input parameters

integer Index=1

echo “Test $0 with |$*|”

while [ $# != 0 ]
do
echo “Parameter [ $Index ] = |$1|”
let Index=$Index+1
shift
done

exit

Roger Smith wrote:

Warren Deitch wrote:

Check the parameters. I have found the input file can be the SECOND
parameter (sometimes!!!) 6.2.0 & 6.2.1 (Nice and deterministic)


I ran spooler manually, with the -vvvv option, and I’m getting “errno 2”
whenver it tries to run my perl print filter. File not found? The file’s
right there…

Warren Deitch wrote:

Is the spooler complaining about the filter or the filter complaining
about the input file ?

I don’t know. It’s just saying “Spawn failed: errno 2.” I must assume
that it’s complaining about the filter, because if I put phs-to-ps back
in the config file, it works just fine.

All I’m doing in /etc/printers/ps.cfg:

  1. Delete the occurrence of phs-to-ps
  2. Replace with the name of my print filter script

Does the filter have execute permission ?

Yes. I can type “printfilter /tmp/Sample.phs > /dev/usbpar0” which is
the exact same syntax used by spooler.

Execute a script instead of your filter. I dug up the old script that
helped me out !

It won’t run the script. “Spawn failed: errno 2”

What it appears like is that spooler has a problem executing an
interpreted script like ksh or perl.

hamtaro@hotmail.com sed in <bm45ub$m5e$1@inn.qnx.com>:

It won’t run the script. “Spawn failed: errno 2”

Shooting in the dark: chmod +x

kabe

kabe@sra-tohoku.co.jp wrote:
kstcj > hamtaro@hotmail.com sed in <bm45ub$m5e$1@inn.qnx.com>:

It won’t run the script. “Spawn failed: errno 2”

kstcj > Shooting in the dark: chmod +x
kstcj > –
kstcj > kabe

And make sure that the first line has:
#!/whatever/will/interpret/this/script

Bill Caroselli wrote:

kstcj > Shooting in the dark: chmod +x –
kstcj > kabe

And make sure that the first line has:
#!/whatever/will/interpret/this/script

BTDT. The perl script will run indepently from the command line. If
either of these things were missing, it wouldn’t run from the command line.

Result: “Spawn failed: errno 2”

For the #! hash-bang notation to work, I’m pretty sure it needs to be
run from a shell. I don’t think a spawn is the same thing.

hamtaro@hotmail.com sed in <bm4fvc$sat$1@inn.qnx.com>:

For the #! hash-bang notation to work, I’m pretty sure it needs to be
run from a shell. I don’t think a spawn is the same thing.

UNIX exec*() series groks #! since older BSD.
Experimented: Both exec*() and spawn*() directly runs #! file.

Of course you need chmod +x beforehand.

kabe

On Fri, 10 Oct 2003 22:52:47 JST, <kabe@sra-tohoku.co.jp> wrote:

hamtaro@hotmail.com > sed in <bm4fvc$sat$> 1@inn.qnx.com> >:

For the #! hash-bang notation to work, I’m pretty sure it needs to be
run from a shell. I don’t think a spawn is the same thing.

UNIX exec*() series groks #! since older BSD.
Experimented: Both exec*() and spawn*() directly runs #! file.

Careful! The actual low level spawn() function only runs a shell script if
the SPAWN_CHECK_SCRIPT bit is set in inherit.flags. This is normally the
case if you call spawn() via one of the spawn*() functions. See the
HelpViewer entry for spawn() for more details.

Rob Rutherford

ruzz@NoSpamPlease.ruzz.com sed in <1nscfgava3wjk$.q2q4cnvxc7zo$.dlg@40tude.net>:

Careful! The actual low level spawn() function only runs a shell script if
the SPAWN_CHECK_SCRIPT bit is set in inherit.flags. This is normally the

Whups? You’re right, thanks for correction. Confirmed.
SPAWN_CHECK_SCRIPT seems to have changed from “(not implemented)” to
implemented in 6.2.

kabe

kabe@sra-tohoku.co.jp wrote:

ruzz@NoSpamPlease.ruzz.com > sed in <1nscfgava3wjk$.q2q4cnvxc7zo$.> dlg@40tude.net> >:


Careful! The actual low level spawn() function only runs a shell script if
the SPAWN_CHECK_SCRIPT bit is set in inherit.flags. This is normally the


Whups? You’re right, thanks for correction. Confirmed.
SPAWN_CHECK_SCRIPT seems to have changed from “(not implemented)” to
implemented in 6.2.

Sounds like we’ve discovered the problem. Looks like the only way out of
this is to write a wrapper binary…

something like env or op?

Roger Smith <hamtaro@hotmail.com> wrote:

kabe@sra-tohoku.co.jp > wrote:

ruzz@NoSpamPlease.ruzz.com > sed in <1nscfgava3wjk$.q2q4cnvxc7zo$.> dlg@40tude.net> >:


Careful! The actual low level spawn() function only runs a shell script if
the SPAWN_CHECK_SCRIPT bit is set in inherit.flags. This is normally the


Whups? You’re right, thanks for correction. Confirmed.
SPAWN_CHECK_SCRIPT seems to have changed from “(not implemented)” to
implemented in 6.2.

Sounds like we’ve discovered the problem. Looks like the only way out of
this is to write a wrapper binary…


cburgess@qnx.com

or sh for that matter… :v)

wasn’t it a perl script? What if you just run

perl /myscript

Roger Smith <hamtaro@hotmail.com> wrote:

kabe@sra-tohoku.co.jp > wrote:

ruzz@NoSpamPlease.ruzz.com > sed in <1nscfgava3wjk$.q2q4cnvxc7zo$.> dlg@40tude.net> >:


Careful! The actual low level spawn() function only runs a shell script if
the SPAWN_CHECK_SCRIPT bit is set in inherit.flags. This is normally the


Whups? You’re right, thanks for correction. Confirmed.
SPAWN_CHECK_SCRIPT seems to have changed from “(not implemented)” to
implemented in 6.2.

Sounds like we’ve discovered the problem. Looks like the only way out of
this is to write a wrapper binary…


cburgess@qnx.com