This builds with CodeWarrior 10 (from 1996) which is probably OK with non-Mac line endings, but there are other old Mac codebases on GitHub using older toolchains that require CR. (i.e. Pararena 2: http://bslabs.net/2016/11/13/building-pararena/)
A PPC Mac running OS X 10.4 is basically the only way to work with both git and classic Mac dev environments, I'll be trying this out myself.
Playing around with Professional MachTen (for 68k) is a real trip though. 4.3BSD, an even older GCC, and it implements virtual memory and protection by taking over the system memory manager. (You actually have to restart when quitting it)
It would be so cool to have something like MachTen on iOS, some people have tried but the restrictions on executable pages really restricts things.
You probably know this, but LF is "line feed" which advances the feed.
CR is "carriage return" which puts the carridge to the start of the line.
The combination makes sense because it does both, it returns the carriage and advances the line.
Just LF kind of makes sense because when you advance the line you can think of the line being empty.
But conceptually just CR suggests returning the carriage but that doesn't imply the newline.
Of course the terminology is originally from type-writers so it doesn't have to make sense, but it does seem odd that some systems chose just CR.
On later type writers both the line feed and carriage return were integrated into a single key or lever, which was just called carriage return or return. From this perspective, an encoding using a lone CR for newlines might make more sense than one using a lone LF. But neither combination really makes intuitive sense in buffered, electronic systems. It's just how it is.
On another note, I find it incredibly weird describing an "everyday" item like a typewriter because many people on HN may have never used one!
Apple's is not the only ecosystem that settled on carriage return. Who do you think was around for them to deliberately break compatibility with in 1977? Kildall?
Just like some people will defend Apple to the death, others will desperately assign malice to literally anything they do. Funny company.
The real surprise is the BBC Micro, which used LF+CR.
If I had to guess I'd say CP/M was developed for extra dumb teletypes that needed both to properly handle a newline. So many quirks in terminals date back to the days when everybody was just making it up as they went along. Legacy support is the root of most braindamage.
”The separation of newline into two functions concealed the fact that the print head could not return from the far right to the beginning of the next line in one-character time. That is why the sequence was always sent with the CR first. A character printed after a CR would often print as a smudge, on-the-fly in the middle of the page, while it was still moving the carriage back to the first position.”
(There's also an entry point partway through the wrapper that just prints a newline. DRY and all that.)
The code is not exactly this, but differs from it in no relevant way:
.osasci \ print char, translating CR to newline
cmp #13:bne oswrch
.osnewl \ print newline
lda #10:jsr oswrch
lda #13:\fall through
.oswrch \ print char without translation
pha
...
pla
rts
The Atom's ROM does the same thing, so they presumably just copied this for the BBC. After all, it doesn't really matter which order you print them.So historically speaking, MS DOS is doing the right thing.
In 1973, the 'internet' was yay big:
https://twitter.com/workergnome/status/807704855276122114/ph...
Apple sold more Apple I's than that in its first few months of existence.
The internet is now 8 or 9 million devices big, and CRLF is still the standard newline for internet protocols.
Who would choose 'beginning of line' to mean 'end of line'?? Oh, Apple :)
The fact that some keyboards say 'return' (but usually have a down-and-to-the-left graphic) is a separate issue, now that we are talking actual hardware; The lack of need for a specific CR, LF keys is obvious. Once again, of course today apple is using the odd choice of 'return', despite the rest of the industry. Many (most?) of 70s onward keyboards had an 'enter' key, no?
This is partly why stty and termios have options for CRLF translation on terminals. I'm sure there's some historical reason for that.
You might also need to force your browser to display with "Western" text encoding (that's what it's called in Firefox, not sure about other browsers).
Best thing about GPL code is that we can fix it!