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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Lost carriage returns !??

Status
Not open for further replies.

kenroush

Programmer
Jan 16, 2002
26
US
I'm using a Windows2000 box as LPD print server for my SCO 3.2v4.2 box.

It works, but everything prints without any carriage returns.

Anyone got any suggestions ?

Ken
 
Unix systems send LF only. Windows systems expect CRLF.

There aere numerous ways to handle this,


Change the printer so that it generates a CR when it gets a line feed. Most printers can do this, and if you use it for DOS, it just means there is an "extra" CR, which changes nothing. This is done with dip switches or a printer configuration panel.


Change the printer by sending it whatever escape sequences it needs to add CR's to LF's. This is going to vary, and you are going to need to add it in the interface script low enough that it doesn't get reset by some other command being sent out.


Set the "stty onlcr opost" in the interface script. This can be done from the printer manager on Release 4 and 5, or by using the "crnlmap" model; unfortunately it does not always work (for example, it can't work for network printers). See:

Move the "stty onlcr opost" to a "hold-open" script (see the article on serial printers) for this port. This works, but it's annoying, and again won't work for network printers.


Filter the output through /usr/lib/lponlcr. This involves piping the output through that on it's way out. In the "standard" script, you might set FILTER=/usr/lib/lponlcr". In other scripts, just add " | /usr/lib/lponlcr" on the line that cats the file.


If you are using an HP network printer, you can add "-n" or even "-N" to the the interface.

Don't add it to the "HPNPF=" line; add it in the line(s) that actually uses $HPNPF. For example, you'd change

if $REALMODEL "$@" | $HPNPF -x $PERIPH 2> $LOG > /dev/null
to
if $REALMODEL "$@" | $HPNPF -x $PERIPH -n 2> $LOG > /dev/null


See man hpnpf Tony Lawrence
SCO Unix/Linux Resources tony@pcunix.com
 
I set an HP4000N printer to add a CR, and it works perfectly.

However, many of the printers here are older HP's. As far as I can tell, none of them has that capability.

I've struggled with the SCO side, and can't find any way to add a CR when the request leaves the box. Configuring ports is apparently not possible when running RLP.

I'm still stumped.
 
Since I almost always have to print to a LAN or remote printer, I use a small script that filters the print file through the SCO program 'xtod'. It is normally named 'LP' and normally placed in '/etc'; looks basically like this:

Code:
# Program ID ..... LP
# Purpose ........ add CR to printfiles
#
for I in "$*"; do
  cat $I | xtod | lp
done

Obviously the files must use the default print characteristics, but there are many ways to include additional capabilities.

gafling
 
You can do anything you want to any network printer by front-ending it with a local printer that adds, filters or does whatever else you want and then passes that to the real network printer.

The concept and implementation is fully discussed at Tony Lawrence
SCO Unix/Linux Resources tony@pcunix.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top