Hello,
I setup my lpd and printcap for my Brother laser printer (PostScript enabled) on my NetBSD system. The problem I am having is that the filter I wrote for it creates an error when handling shell script files. I think the error comes when the filter tries to process the files commands instead of printing them, but I am unsure of how to fix it.
Here is my /etc/printcap:
Code:
lp|local printer|Brother HL-5240
:lp=/dev/ulpt0:sd=/var/spool/lpd/lp:lf=/var/log/lpd-errors:\
:sh:mx#0:if=/usr/pkg/bin/t2ps-filter:
I took the filter straight out of "FreeBSD: The Complete Reference". Here is the t2ps-filter:
Code:
#!/bin/sh
# Check to see if input is PostScript. If not, pass through enscript.
read firstline
firstline=`expr "$firstline" : '\(..\)'`
if [ "$firstchars" = "%!" ]
then
# PostScript file; pass through $firstline and rest of file
echo "$firstline" && cat && printf "\004"
exit 0
else
# Not PostScript file; use enscript to process
(echo "$firstline"; cat) | /usr/pkg/bin/enscript -p- \
&& printf "\004"
exit 0
fi