3 ms·
Nice history recap, most of which I lived through, but it's missing the Bill Gates/PCDOS botch of using CR and LF as the text line separator, a result of not do
by jibal 1y ago
Nice history recap, most of which I lived through, but it's missing the Bill Gates/PCDOS botch of using CR and LF as the text line separator, a result of not doing a logical translation of the characters sent by the terminal. UNIX sort of did it right by just using LF, but it would have been better to use NUL as the terminator--then there wouldn't have been the need to strip off LF on input and add it back on output and we wouldn't have the special case, handled differently by numerous programs, of a file ending with a line lacking an LF terminator ... and there wouldn't be the numerous bugs and weird behavior resulting from lines containing NULs.
- chuckadams 1y agoUsing NUL as the terminator would have been incredibly incompatible with Unix's choice of systems programming language. PC-DOS did not invent CRLF as the line terminator, it was already in common use in CP/M and VMS at the time.
- jibal 1y agoNo, it would have been completely compatible with C ... that's the point.
- chuckadams 1y agoCompletely compatible, other than making most programs incapable of expressing multiple lines in one string that is. Or a partial line in a single string, since "end of line" and "end of string" would be indistinguishable.
- jibal 1y agoThis is conceptually confused. There are numerous ways to represent multiple lines in applications that want to operate on them, including separating them with LF, or any other code sequence ... but a better choice is using an array of pointers. As for partial lines, this is a matter of how one is semantically interpreting a string ... numerous C programs operate on lines with the LF stripped, and operate on all sorts of other strings, including substrings of lines. Anyway, it's moot since UNIX didn't take this approach. I won't respond further.