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.
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…
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:
Delete the occurrence of phs-to-ps
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.
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.