summaryrefslogtreecommitdiff
path: root/term/devio.c
diff options
context:
space:
mode:
Diffstat (limited to 'term/devio.c')
-rw-r--r--term/devio.c40
1 files changed, 35 insertions, 5 deletions
diff --git a/term/devio.c b/term/devio.c
index 32ac0387..6c5a9683 100644
--- a/term/devio.c
+++ b/term/devio.c
@@ -1,4 +1,4 @@
-/*
+/*
Copyright (C) 1995, 1996, 1998 Free Software Foundation, Inc.
Written by Michael I. Bushnell, p/BSG.
@@ -77,6 +77,10 @@ static device_t device_master;
static int output_stopped;
+/* XXX Mask that omits high bits we are currently not supposed to pass
+ through. */
+static int char_size_mask_xxx = 0xff;
+
/* Forward */
static void devio_desert_dtr ();
@@ -302,7 +306,13 @@ device_read_reply_inband (mach_port_t replypt,
if (!error_code && (termstate.c_cflag & CREAD))
for (i = 0; i < datalen; i++)
{
- flush = input_character (data[i]);
+ int c = data[i];
+
+ /* XXX Mach only supports 8-bit channels; this munges things
+ to account for the reality. */
+ c &= char_size_mask_xxx;
+
+ flush = input_character (c);
if (flush)
break;
}
@@ -535,9 +545,29 @@ devio_set_bits ()
else
termstate.c_cflag &= ~CSTOPB;
- /* Mach only supports 8 bit channels. So wark the CSIZE to conform. */
- termstate.c_cflag = ((termstate.c_cflag & ~CSIZE)
- | ((termstate.c_cflag & PARENB) ? CS7 : CS8));
+ /* Figure out how to munge input, since we are unable to actually
+ affect what the hardware does. */
+ switch (termstate.c_cflag & CSIZE)
+ {
+ case CS5:
+ char_size_mask_xxx = 0x1f;
+ break;
+
+ case CS6:
+ char_size_mask_xxx = 0x3f;
+ break;
+
+ case CS7:
+ char_size_mask_xxx = 0x7f;
+ break;
+
+ case CS8:
+ default:
+ char_size_mask_xxx = 0xff;
+ break;
+ }
+ if (termstate.c_cflag & PARENB)
+ char_size_mask_xxx |= 0x80;
}
}