In answer to Annihilannic, passthrough printing is more about configuring the printer than the termcap. When I was setting mine up I looked into the pf and po termcap entries, and some other "alleged" behind the scenes functions, but the setup that actually worked was under the following help screen from the gui interface:
Operating Systems Documentation Set
System Administration Guide
Chapter 4 - Managing Printers and Print Jobs
Customizing Printer Configuration
Configuring a spooled local terminal printer
I took the sco example provided in the help screen and modified it to identify the termport based on where the userid is logged in instead of a fixed port:
Code:
#terminal passthrough printing interface file
termport=`who | awk '{if ($1==id) {printf("/dev/%s",$2);exit(0)}}' id=$2`
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^#identify the terminal tty port
#Note: The line above must occur before the $2 'user id' parameter is cleared
shift; shift; shift; shift; shift #clear print job options to prepare for print
penable="\033[5i" #string to turn printer output on
pdisable="\033[4i" #string to turn printer output off
sttystr="ixon -ixany ixoff" #string to configure printer flow control
sleep 5 #wait 5 seconds to let any screen draws finish
exec <$termport >$termport 2>/dev/null #redirect standard out to printer
sttysave=`stty -g` #save terminal settings
stty $sttystr #turn on printer flow control
echo -n "$penable" #turn on printer output
...
#spool print job to standard out#
...
echo -n "$pdisable" #turn off printer output
stty $sttysave #restore terminal settings
exit 0 #exit interface script
The above port identification method works as long as users don't log on more than once simultaneously. I currently have situations where this does not work, so I have now had to modify the lp command to pipe the job ID and initiating port id to a special log file that I use to accurately identify the port.
Basically I renamed /usr/bin/lp to /usr/bin/lporig, then replaced /usr/bin/lp with the following script:
Code:
#!/bin/sh
lptty=`/bin/tty`
pout=`/usr/bin/lporig $*`
/bin/echo $lptty $pout >>/var/spool/lp/logs/printplog
/bin/echo $pout
Then in the above interface file I changed:
Code:
termport=`who | awk '{if ($1==id) {printf("/dev/%s",$2);exit(0)}}' id=$2`
to
Code:
termport=`awk '{if ($5==pid) {printf("%s\n",$1);exit(0)}}' pid=$1 /var/spool/lp/logs/printplog`
To keep the log file from growing out of control I “tail” it in my nightly cron in order to delete the oldest entries.
The new method works flawlessly, but I don't recommend modifying system commands if you don't have to.
I only use passthrough for dialin and remote terminals where network printing is unavailable. I use samba for printing on my local network.