Newsgroups: comp.text Path: utzoo!utgpu!watserv1!watdragon!watsol.waterloo.edu!tbray From: tbray@watsol.waterloo.edu (Tim Bray) Subject: meaning of newlines Message-ID: <1991Feb14.195258.20850@watdragon.waterloo.edu> Sender: daemon@watdragon.waterloo.edu (Owner of Many System Processes) Organization: University of Waterloo References: <7813@exodus.Eng.Sun.COM> Date: Thu, 14 Feb 1991 19:52:58 GMT Lines: 30 tut@cairo.Eng.Sun.COM (Bill "Bill" Tuthill) writes: The world's three most important operating systems-- Unix, MS-DOS, and MacOS-- all employ different methods for separating lines from each other.... That is, do any of these three operating systems have any justification (other than space savings in the case of Unix and MacOS) for doing things they way they did? Depends what you mean by a line. If you mean "visual breaking-up of a sequence of text to fit on a page", DOS is closest to right, since such breaking-up is in fact accomplished by a motion to the left margin (CR) and a motion down (LF). If you mean "record separator in a file whose elements happen to be mostly 7-bit ASCII" then there is no particular argument either way, and the most compact is probably the best. The problem is that Unix has historically kludged this by overloading the semantics of the '\n' character, using it both as a record separator (viz. /etc/passwd) and having the terminal driver capable of special behavior to produce nice-looking "lines" of text. This is fine in most of the cases. However, when you get a complex piece of text with no natural "record" divisions (and one of the strengths of Unix is that it has freed us, by and large, from the tyranny of record- orientedp processing), this overloading of '\n' really begins to bite. To start with, vi, sed, grep, and so on stop working if you don't have enough '\n' characters. Anyhow, I had a sermon on this subject in my paper of the Winter '89 Usenix... Cheers, Tim Bray, Open Text Systems