Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help on printing from SCO Open Server 5.05 1

Status
Not open for further replies.

stilley

Programmer
Jan 16, 2003
52
CA
Hi, I am using an emulator to connect to an application that runs on my Unix box. The emulator is called Power Term version 4. I want to be able to print reports from my application to a parallel printer hooked up to a Windows based PC that runs Power Term. I don't mean things like print screens or windows based printouts but actual Unix system software reports. I'm not having any luck setting this up although it seems very easy. Maybe someone has been in this situation before and can advise me. Thanks.
 
You can install "Microsoft TCP/IP Printing" if you are using Windows NT or 2000 to enable LPR printing to Windows. It's free with the OS but not installed by default. With this solution you would still be faced with the problem of determining which computer the user is logged in to and where to send the print job.

I'm curious about terminal pass-through printing; looking at the terminfo(M) man page though it seems to me that 'po' and 'pf' are the more likely candidates; is this correct?

[tt] plab_norm pln pn Prog label #1 to show string #2
print_screen mc0 ps Print contents of the screen
prtr_non mc5p pO Turn on the printer for #1 bytes
prtr_off mc4 pf Turn off the printer
prtr_on mc5 po Turn on the printer[/tt]

Personally I would recommend using tput capability rather than looking up the escape sequence for a terminal capability as that way it's more likely to work should the user's terminal type be different. Annihilannic.
 
I appreciate all your help guys! Stanhubble, when I go to the samba ftp site to download it, there are a bunch of VOLS files in there, how do I know which one is correct?
 
Not sure what you have decided or if your problem is resolved BUT FYI - we use a product called FacetWin that does exactly what you are looking for. FacetWin prints spooled UNIX reports through the PC to the local printer. We use Facetwin in a number of our user sites without problems. If you would like further information let me know.
 
stilley,

The site i listed is the sco ftp server and the different ones there are different versions of samba. I would suggest you take the latest one.
 
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 &quot;$penable&quot;                     #turn on printer output
...
#spool print job to standard out#
...
echo -n &quot;$pdisable&quot;                    #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(&quot;/dev/%s&quot;,$2);exit(0)}}' id=$2`
to
Code:
termport=`awk '{if ($5==pid) {printf(&quot;%s\n&quot;,$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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top