(OLDER) <- More Stuff -> (NEWER) (NEWEST)
Printer Friendly Version



We no longer offer ftp downloads. If there is a file you need referenced here, please contact me by email and I will get it to you.

This article is from a FAQ concerning SCO operating systems. While some of the information may be applicable to any OS, or any Unix or Linux OS, it may be specific to SCO Xenix, Open Desktop or Openserver.

There is lots of Linux, Mac OS X and general Unix info elsewhere on this site: Search this site is the best way to find anything.

Printing FAQ

How do I stop staircase output on the printer?





Staircase is when you printer prints like this:

 Everything starts out OK, but when you reach 
                                              the end of a line, it moves
                                                                          down but not back
 

(With a laser printer, the same problem will cause only one or even no lines to print)

This is caused by the different ways that DOS and Unix handle the end of a text line. Unix ends a line with a LF (Line Feed, 0x0A) character, while DOS uses both a LF and a CR (Carriage Return, 0x0D).

If a printer is expecting both characters, getting only a LF tells it to only do a Line Feed without a Carriage Return, so that's just what it does, and that's just what you get.

There are at least five ways to fix 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: /Unixart/netprint.html

  • 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
     
    

    You can download ftp://ftp.aplawrence.com/pub/netcat.hp.model See man hpnpf



David DiPieto offered these thoughts:

 Date: Tue, 29 Dec 1998 16:05:40 -0500
 From: David DiPietro <abacus@garden.net>
 To: tony@aplawrence.com
 Subject: printer stairstepping ...
 Content-Type: text/plain; charset=us-ascii
 Content-Transfer-Encoding: 7bit
 
 I thought I'd share a little opost experience with you.  When I install
 our application software I automatically add a "holdopen" for each
 parallel and serial printer to append the <cr> to <lf> as you mention in
 your printer discussion.  Most of our sites now involve some kind of
 networking and printer sharing.  I had been putting the high-speed
 lasers on the parallel ports on the SCO Unix server but starting having
 a problem with Windows applications printing graphics.  I would often
 loose data or get garbled graphics.  I finally decided to take the time
 to figure out what was going on using the hex dump mode on a Lexmark
 Laser.  Apparently, and with understanding, having opost onlcr turned on
 will do a straight binary filter of the printer data replacing all <nl>
 with <cr><nl> - even if it occurs in the middle of a raster graphics
 string.  This could - and will most likely - reak havoc on the output! 
 You may want to address this in your discussion.  In my case, the
 problem was solved completely by turning on the auto <cr> at the
 printer.
 Dave DiPietro/Abacus Systems Inc.
 (973) 875-9900
 



Click here to add your comments



Don't miss responses! Subscribe to Comments by RSS or by Email

Click here to add your comments


If you want a picture to show with your comment, go get a Gravatar


cartoon

/SCOFAQ/FAQ_scotec7staircase.html copyright 1997-2003 (various) All Rights Reserved

Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.

Publishing your articles here

Jump to Comments



Many of the products and books I review are things I purchased for my own use. Some were given to me specifically for the purpose of reviewing them. I resell or can earn commissions from the sale of some of these items. Links within these pages may be affiliate links that pay me for referring you to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain. I also may own stock in companies mentioned here. If you have any question, please do feel free to contact me.

Specific links that take you to pages that allow you to purchase the item I reviewed are very likely to pay me a commission. Many of the books I review were given to me by the publishers specifically for the purpose of writing a review. These gifts and referral fees do not affect my opinions; I often give bad reviews anyway.

We use Google third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.



More:
       - FAQ
       - Printing


Unix/Linux Consultants

Skills Tests

Guest Post Here











My Favorites

Change Congress