Alfred Perlstein <[EMAIL PROTECTED]> writes:
> My concern is that just adding these defines doesn't actually implement
> anything in the drivers/libraries. :)
Right, but stealing these small snippets from NetBSD wasn't very hard,
see patch below.
/assar
Index: sys/sys/termios.h
===================================================================
RCS file: /home/ncvs/src/sys/sys/termios.h,v
retrieving revision 1.14
diff -u -w -r1.14 termios.h
--- sys/sys/termios.h 2000/11/28 20:03:23 1.14
+++ sys/sys/termios.h 2000/12/29 02:40:21
@@ -112,6 +112,9 @@
#define ONLCR 0x00000002 /* map NL to CR-NL (ala CRMOD) */
#define OXTABS 0x00000004 /* expand tabs to spaces */
#define ONOEOT 0x00000008 /* discard EOT's (^D) on output) */
+#define OCRNL 0x00000010 /* map CR to NL on output */
+#define ONOCR 0x00000020 /* no CR output at column 0 */
+#define ONLRET 0x00000040 /* NL performs CR function */
#endif /*_POSIX_SOURCE */
/*
Index: sys/kern/tty.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/tty.c,v
retrieving revision 1.142
diff -u -w -r1.142 tty.c
--- sys/kern/tty.c 2000/12/08 21:50:36 1.142
+++ sys/kern/tty.c 2000/12/29 02:40:23
@@ -663,9 +663,16 @@
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))
@@ -680,6 +687,9 @@
case CONTROL:
break;
case NEWLINE:
+ if (ISSET(tp->t_oflag, ONLCR | ONLRET))
+ col = 0;
+ break;
case RETURN:
col = 0;
break;