T
Thomas Dickey
Fortunately, Thompson was intelligent enough to realize that the
control characters for printing devices should not determine the
representation of text files. The conversion is tucked away into the
kernel, and can be turned on and off.
....and an equivalent optional feature is built into most terminal emulators.
That's the LNM mode documented in ECMA-48, e.g., (from xterm's documentation):
CSI Pm h Set Mode (SM)
Ps = 2 0 -> Automatic Newline (LNM)
CSI Pm l Reset Mode (RM)
Ps = 2 0 -> Normal Linefeed (LNM)
The VT100 terminal, which is widely emulated today, also works this
way, and so Unix systems in general nearly always have the ONLCR flag
turned on when communicating with their own character consoles or
terminal emulators like xterm, etc.
....of course the terminal drivers don't use the mode - it's done
by sending explicit CR/LF codes.