+
+/*
+ * The conversions from sgttyb to termios make LITOUT and PASS8 affect
+ * the parity. So every TIOCSETP ioctl has to be paired with a TIOCLSET
+ * ioctl (at least if LITOUT or PASS8 has changed, and PASS8 may vary
+ * with 'n').
+ */
+set_tmode(n)
+ int n;
+{
+ long allflags;
+
+ allflags = setflags(n);
+ tmode.sg_flags = allflags & 0xffff;
+ allflags >>= 16;
+ if (n == 2) {
+ if (crmod || NL)
+ tmode.sg_flags |= CRMOD;
+ if (upper || UC)
+ tmode.sg_flags |= LCASE;
+ if (lower || LC)
+ tmode.sg_flags &= ~LCASE;
+ }
+ ioctl(0, TIOCSETP, &tmode);
+ ioctl(0, TIOCLSET, &allflags);
+}