* [PATCH] termios.3: Clarify ONLRET
@ 2022-01-01 22:55 Simon Branch
2022-01-25 17:34 ` Alejandro Colomar (man-pages)
0 siblings, 1 reply; 2+ messages in thread
From: Simon Branch @ 2022-01-01 22:55 UTC (permalink / raw)
To: linux-man; +Cc: alx.manpages, mtk.manpages, 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)
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(-)
diff --git a/man3/termios.3 b/man3/termios.3
index c11937458..20641f14d 100644
--- a/man3/termios.3
+++ b/man3/termios.3
@@ -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.
--
2.34.0
---
man3/termios.3 | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/man3/termios.3 b/man3/termios.3
index c11937458..20641f14d 100644
--- a/man3/termios.3
+++ b/man3/termios.3
@@ -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.
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] termios.3: Clarify ONLRET
2022-01-01 22:55 [PATCH] termios.3: Clarify ONLRET Simon Branch
@ 2022-01-25 17:34 ` Alejandro Colomar (man-pages)
0 siblings, 0 replies; 2+ messages in thread
From: Alejandro Colomar (man-pages) @ 2022-01-25 17:34 UTC (permalink / raw)
To: Simon Branch, linux-man; +Cc: mtk.manpages
Hello Simon,
On 1/1/22 23:55, Simon Branch wrote:
> 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.
>
> ---
Thanks for the patch!
I applied it, and signed it for you.
<http://www.alejandro-colomar.es/src/alx/linux/man-pages/man-pages.git/commit/?id=958604aae25a096d2c28410633af04a8bd068a73>
Cheers,
Alex
> man3/termios.3 | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/man3/termios.3 b/man3/termios.3
> index c11937458..20641f14d 100644
> --- a/man3/termios.3
> +++ b/man3/termios.3
> @@ -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.
--
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-01-25 17:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-01 22:55 [PATCH] termios.3: Clarify ONLRET Simon Branch
2022-01-25 17:34 ` Alejandro Colomar (man-pages)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox