termios.3: Clarify ONLRET
PATCH 1/1 termios.3: Clarify ONLRET
While perusing various termios(3) and termios(4) manpages, I noticed the following inconsistency for ONLRET. FreeBSD and NetBSD say this:
If ONLRET is set, the NL character is assumed to do the carriage-return function; the column pointer will be set to 0.
OpenBSD says this:
If ONLRET is set, NL also performs CR on output, and reset current column to 0.
POSIX says this:
NL performs CR function.
The current Linux manpage says this (!):
Don't output CR.
Here's a snippet that demonstrates Linux's behavior (tl;dr it's just like the other operating systems):
$ stty -icanon -onlcr -icrnl -echo onlret onocr; cat
this is some text (^J pressed)
and some more (^M pressed before additional text)The first flags (-icanon -onlcr -icrnl -echo), combined with cat, ensure that our keys are sent directly back to the terminal emulator without any translation or buffering. The last two (ONLRET and ONOCR) are the important ones: ONLRET makes Linux think that the cursor is at column 0 after the ^J, and ONOCR makes Linux ignore the following ^M.
--- man3/termios.3 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
man3/termios.3 +3 -1
@@ -203,7 +203,9 @@ Map CR to NL on output. Don't output CR at column 0. .TP .B ONLRET -Don't output CR. +The NL character is assumed to do the carriage-return function; +the kernel's idea of the current column is set to 0 +after both NL and CR. .TP .B OFILL Send fill characters for a delay, rather than using a timed delay.
Signature · 5 lines
2.34.0 --- man3/termios.3 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
man3/termios.3 +3 -1
@@ -203,7 +203,9 @@ Map CR to NL on output. Don't output CR at column 0. .TP .B ONLRET -Don't output CR. +The NL character is assumed to do the carriage-return function; +the kernel's idea of the current column is set to 0 +after both NL and CR. .TP .B OFILL Send fill characters for a delay, rather than using a timed delay.
Signature · 1 line
2.34.1
Hello Simon,
Quoted 26 lines · Simon Branch
While perusing various termios(3) and termios(4) manpages, I noticed the following inconsistency for ONLRET. FreeBSD and NetBSD say this:
If ONLRET is set, the NL character is assumed to do the carriage-return function; the column pointer will be set to 0.
OpenBSD says this:
If ONLRET is set, NL also performs CR on output, and reset current column to 0.
POSIX says this:
NL performs CR function.
The current Linux manpage says this (!):
Don't output CR.
Here's a snippet that demonstrates Linux's behavior (tl;dr it's just like the other operating systems):
$ stty -icanon -onlcr -icrnl -echo onlret onocr; cat this is some text (^J pressed) and some more (^M pressed before additional text)
Quoted 7 lines
The first flags (-icanon -onlcr -icrnl -echo), combined with cat, ensure that our keys are sent directly back to the terminal emulator without any translation or buffering. The last two (ONLRET and ONOCR) are the important ones: ONLRET makes Linux think that the cursor is at column 0 after the ^J, and ONOCR makes Linux ignore the following ^M.
---
Thanks for the patch!
I applied it, and signed it for you.
Cheers,
Alex
Quoted 18 lines
man3/termios.3 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)man3/termios.3 +3
-1@@ -203,7 +203,9 @@ Map CR to NL on output. Don't output CR at column 0. .TP .B ONLRET -Don't output CR. +The NL character is assumed to do the carriage-return function; +the kernel's idea of the current column is set to 0 +after both NL and CR. .TP .B OFILL Send fill characters for a delay, rather than using a timed delay.
Signature · 3 lines
Alejandro Colomar Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/ http://www.alejandro-colomar.es/