diff options
author | joerg <joerg@FreeBSD.org> | 1996-08-12 21:31:07 +0000 |
---|---|---|
committer | joerg <joerg@FreeBSD.org> | 1996-08-12 21:31:07 +0000 |
commit | dcde70f16b3def70b46002b990f4080b63850b7c (patch) | |
tree | b18f0e7ff333c94c5c3bc3bf09bca8bc8f51532e /sys/i386/isa/pcvt/pcvt_drv.c | |
parent | 084c9a9ee62a92c88d40e132afda3e098c2fa304 (diff) | |
download | FreeBSD-src-dcde70f16b3def70b46002b990f4080b63850b7c.zip FreeBSD-src-dcde70f16b3def70b46002b990f4080b63850b7c.tar.gz |
Fix two minor oddities introduced by my yesterday's patches:
. preserve a multi-char sequence in a small static buffer inside
pccngetc(), so it won't be clobbered later (used to happen when
breaking into DDB user Ctrl-Alt-ESC), and
. simplify the ``keystroke is present'' determination in sgetc(), thus
making pccncheck() actually working without waiting for a keystroke.
Diffstat (limited to 'sys/i386/isa/pcvt/pcvt_drv.c')
-rw-r--r-- | sys/i386/isa/pcvt/pcvt_drv.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/sys/i386/isa/pcvt/pcvt_drv.c b/sys/i386/isa/pcvt/pcvt_drv.c index 977d86e..debb60f 100644 --- a/sys/i386/isa/pcvt/pcvt_drv.c +++ b/sys/i386/isa/pcvt/pcvt_drv.c @@ -1207,7 +1207,8 @@ int pccngetc(Dev_t dev) { register int s; - static u_char *cp; + static u_char *cp, cbuf[4]; /* Temp buf for multi-char key sequence. */ + register u_char c; #ifdef XSERVER @@ -1233,14 +1234,21 @@ pccngetc(Dev_t dev) cp = sgetc(0); kbd_polling = 0; splx(s); + c = *cp++; + if (c && *cp) { + /* Preserve the multi-char sequence for the next call. */ + bcopy(cp, cbuf, 3); /* take care for a trailing '\0' */ + cp = cbuf; + } else + cp = 0; #if ! (PCVT_FREEBSD >= 201) /* this belongs to cons.c */ - if (*cp == '\r') - *cp = '\n'; + if (c == '\r') + c = '\n'; #endif /* ! (PCVT_FREEBSD >= 201) */ - return (*cp++); + return c; } #if PCVT_FREEBSD >= 200 |