Reply to: SUMMARY : Printcap spool file
Thanks to Stephen Harris and Gene Rackow for the replies. I have not really
find time to test out but Gene's filter looks pretty promising and seems to be
what I wanted.
From: sweh@mpn.com (Stephen Harris)
It's a filter so the file is on stdin - just "cat" to send it to stdout and
thus the printer
From: Gene Rackow <rackow@mcs.anl.gov>
The problem is that the filters get the data on stdin, not as a file name.
Here is a segment of the code I use to pre-precess input. It's not very
nice in that it requires that there is tmp space to copy the spool file,
but it was a quick and dirty hack that works on several systems.
the ps?f filters are all the same script with a case statement to switch
actions on name. There are also some better ways to deal with this
depending on the software that you are using and the type of printer.
I've got a couple that require some real oddities, and this method was
the only one that worked reliably for the lpd spoolers.
.....
tmp=XXtmp$$
.....
while test $# != 0
do case "$1" in
-c) ;;
-w*) width=$1 ;;
-l*) length=$1 ;;
-i*) indent=$1 ;;
-x*) width=$1 ;;
-y*) length=$1 ;;
-n) user=$2 ; shift ;;
-n*) user=`expr $1 : '-.\(.*\)'` ;;
-h) host=$2 ; shift ;;
-h*) host=`expr $1 : '-.\(.*\)'` ;;
-*) ;;
*) afile=$1 ;;
esac
shift
done
.....
case $prog in
psif)
cat > $tmp
file $tmp | grep -i -s Postscript
s=$?
if [ $s -eq 1 ] ; then
/usr/local/bin/enscript $PSAVE -q -l -p $tmp.save $tmp
else
mv $tmp $tmp.save
fi
rm -f $tmp ,* gs_*
;;
psnf) psdit > $tmp.save
....
esac
....
cat $tmp.save >$DEV
....
--Gene
Original question:
>Do anyone know a way to capture the spool file first before passing it to
the
>/dev/ttya? I need to add userid to the spool file as well as to minus print
>quota before I spool them to the printer.
>
>It seems that I could use "if" or "of" or "af" in /etc/printcap and man
pages
>do not seem that helpful. When I use "if", I manage to minus the quota but
>because I do not know the spool file name, I could not manage to spool them
t
> o
>the printer.
>
>Do anyone know how to determine the spool file name or is there a way to
>specify a certain spool file name I want?
>
>I will summarise and any help will be appreciated.
>
>Regards,
>Stanley Tam
>
>
>
This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:11:05 CDT