Subject: Re: TTYs and 7E1
To: Jan-Hinrich Fessel <oskar@zappa.unna.ping.de>
From: Terry Moore <tmm@mcci.com>
List: current-users
Date: 09/28/1995 11:43:53
With many caveats, (eg. it may break things that now work),
here's a potential solution to the problem. 7E1 happens because
ttcompatsetflags() in kern/tty_compat.c sets CS7 unless it sees PASS8
set on entry; and ttcompatgetflags() doesn't set PASS8 unless
it sees PASS8 set in the t_flags word. Any solution to the sgtty()
emulation dodge is going to be a bit of a hack, and wrong in
some cases, but why not choose to return PASS8 if we see that we're
in CS8 mode? As far as I can see, sgtty() with PASS8 set doesn't
set the underlying PASS8 flag in the t_flags word of the
struct tty; and anyway, setting PASS8 shouldn't harm us if we're
in CS8 mode anyway.
Here's the patch in case anyone wants to try this; I've run into
the problem, too, but don't have time to rebuild a system and
test this right now.
(The other alternative, of course, is to provide a substitute
sgtty.h with room to stash the additional properties, and a signature
(e.g., crc or checksum) on the stash; then provide substitute sgtty
routines that use the stashed info, if valid, to restore the appropriate
termios entries such as CS8. Then compile/link with the substitute.)
The patch:
--- 1.1 1995/09/28 14:55:54
+++ tty_compat.c 1995/09/28 15:34:10
@@ -1,4 +1,5 @@
/* $NetBSD: tty_compat.c,v 1.14.2.1 1994/08/03 03:51:06 cgd Exp $ */
+/* $Id: tty_compat.c,v 1.2 1995/09/28 15:15:59 tmm Exp $ */
/*-
* Copyright (c) 1982, 1986, 1991, 1993
@@ -33,6 +34,11 @@
* SUCH DAMAGE.
*
* @(#)tty_compat.c 8.1 (Berkeley) 6/10/93
+ *
+ * 9/28/95 tmm@mcci.com
+ * Return PASS8 when emulating sgtty() and the line is in CS8 mode;
+ * unproven effort to improve porting of sgtty()-dependent programs
+ * to NetBSD.
*/
/*
@@ -260,7 +266,8 @@
} else {
if ((tp->t_flags & LITOUT) && !(oflag & OPOST))
flags |= LITOUT;
- if (tp->t_flags & PASS8)
+ if (tp->t_flags & PASS8 ||
+ (cflag & CSIZE) == CS8)
flags |= PASS8;
}