From: utzoo!decvax!harpo!eagle!mhtsa!alice!research!dmr Newsgroups: net.unix-wizards Title: NL vs CR-LF Article-I.D.: research.292 Posted: Wed Sep 8 02:19:13 1982 Received: Thu Sep 9 02:55:18 1982 I'm not positive I saw the original question, and probably haven't seen all the replies. But here are some thoughts. Early Teletype machines (like the model 14 and 28, and later the 35 and 33) used separate CR and LF codes, which has always seemed silly, especially given the limited code space of Baudot, which the first 2 used. Other relatively old terminals, such as the IBM 1050 and 2741, used a single character for the new-line function. (Some of the IBM terminals had a separate "index" character that performed the LF function). It was quite early in the career of ASCII, not just in the last 5-10 years, that the NL was accepted as an alternate interpretation of the LF code. It is a much more sensible choice, since the combined function of "new line" is much more common than either CR or LF separately. The Teletype model 37 terminal optionally interpreted NL characters (to enable the option one installed a small spring.) CTSS, Multics, and finally Unix adopted the convention of a single NL character for the following reasons. 1) Given that one is interpreting character streams (not records) it is much better to use a single character than a pair of characters to mark the end of a line. For example, it is annoying for every program to have to invent an interpretation for one of the characters alone or the two in the wrong order. 2) Given that a single character is to be used, it is better to use one that conforms to the standard. I have always been curious why terminal manufacturers have never adopted NL, at least as an option. A lot of terminals can send out CR-LF when you push the return key, but this is useless. I think the original question was: why not use \r (CR) instead of \n (NL) to demarcate lines? The answer is: 1) It isn't as "standard" ASCII 2) It would be a pain to change 3) It would not make life any easier anyway, since instead of having to translate \n -> CR LF, the system would now have to translate \r -> CR LF. Dennis Ritchie