<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Sun, 09 Jun 2013 11:47:47 -0400
From   : lists@... (Stephen Harris)
Subject: Acorn newline sequence

On Sun, Jun 09, 2013 at 04:16:44PM +0100, J.G.Harston wrote:
> Stephen Harris wrote:
> >> Does anybody have any ideas why Acorn ended up with their newline
> >> sequence of <10><13> instead of <13><10> as used everywhere else in 
> >> the world?
> >
> > "everywhere" ?  Unix uses <13> and had done since the early 70s.

My typo; I meant <10>

> I specifically said "newline", not "end-of-line". Acorn's end-of-line 

Unix's newline character is <10> 

  $ printf "hello\nthere\n" | hdump
  00000000  68 65 6C 6C 6F 0A 74 68   hello.th
  00000008  65 72 65 0A               ere.
  $ 
  $ printf "hello\nthere\n"
  hello
  there
  $ 

It's up to the drivers to deal with this in a sane way.

You can turn off the NL->CRNL translation in the TTY driver:

  $ stty -onlcr
  $ printf "hello\nthere\n"
                           hello
                                there
                                     $ 

This staircase effect is normal with printers if you're not careful :-)

The standard TTY driver can do lots of oddities...

       * [-]ocrnl
              translate carriage return to newline

       * [-]onlcr
              translate newline to carriage return-newline

       * [-]onlret
              newline performs a carriage return

       * [-]onocr
              do not print carriage returns in the first column

Although not all options are always implemented on every system.

> With my manual typewriter when you push the newline lever across from 
> the right to the left it moves the carriage across, and then at the 
> maximum extent it engages the cogs to move the drum up one line. So, 
> <cr><lf> (<13><10>).

Huh; that's different the one I used as a kid.  I got used to gentle taps
of the handle to do a line feed.

-- 

rgds
Stephen
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>