summaryrefslogtreecommitdiffstats
path: root/sys/kern/tty.c
diff options
context:
space:
mode:
authorassar <assar@FreeBSD.org>2001-03-04 06:04:50 +0000
committerassar <assar@FreeBSD.org>2001-03-04 06:04:50 +0000
commitc78c138f0f1e0db42115c306e06a6c59f6d5b4bc (patch)
treea8c2687c4b1bd822502b1894633d12e6b935cec7 /sys/kern/tty.c
parent35583224c700ea795d0000e00b57a46e7f96d2fb (diff)
downloadFreeBSD-src-c78c138f0f1e0db42115c306e06a6c59f6d5b4bc.zip
FreeBSD-src-c78c138f0f1e0db42115c306e06a6c59f6d5b4bc.tar.gz
implement OCRNL, ONOCR, and ONLRET
Obtained from: NetBSD
Diffstat (limited to 'sys/kern/tty.c')
-rw-r--r--sys/kern/tty.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/kern/tty.c b/sys/kern/tty.c
index 1bc30ca..a7ba12d 100644
--- a/sys/kern/tty.c
+++ b/sys/kern/tty.c
@@ -667,9 +667,16 @@ ttyoutput(c, tp)
if (c == '\n' && ISSET(tp->t_oflag, ONLCR)) {
tk_nout++;
tp->t_outcc++;
- if (putc('\r', &tp->t_outq))
+ if (!ISSET(tp->t_lflag, FLUSHO) && putc('\r', &tp->t_outq))
return (c);
}
+ /* If OCRNL is set, translate "\r" into "\n". */
+ else if (c == '\r' && ISSET(tp->t_oflag, OCRNL))
+ c = '\n';
+ /* If ONOCR is set, don't transmit CRs when on column 0. */
+ else if (c == '\r' && ISSET(tp->t_oflag, ONOCR) && tp->t_column == 0)
+ return (-1);
+
tk_nout++;
tp->t_outcc++;
if (!ISSET(tp->t_lflag, FLUSHO) && putc(c, &tp->t_outq))
@@ -684,6 +691,9 @@ ttyoutput(c, tp)
case CONTROL:
break;
case NEWLINE:
+ if (ISSET(tp->t_oflag, ONLCR | ONLRET))
+ col = 0;
+ break;
case RETURN:
col = 0;
break;
OpenPOWER on IntegriCloud