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.
This commit is contained in:
Joerg Wunsch 1996-08-12 21:31:07 +00:00
parent 9f0a4b33d9
commit 3f0aecd3b5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=17560
2 changed files with 15 additions and 9 deletions

View File

@ -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

View File

@ -935,10 +935,9 @@ sgetc(int noblock)
/* see if there is data from the keyboard available either from */
/* the keyboard fifo or from the 8042 keyboard controller */
if ((noblock && pcvt_kbd_count) ||
((!noblock || kbd_polling) && (inb(CONTROLLER_CTRL) & STATUS_OUTPBF)))
if (pcvt_kbd_count || (inb(CONTROLLER_CTRL) & STATUS_OUTPBF))
{
if (!noblock || kbd_polling) /* source = 8042 */
if (!pcvt_kbd_count) /* source = 8042 */
{
PCVT_KBD_DELAY(); /* 7 us delay */
dt = inb(CONTROLLER_DATA); /* get from obuf */
@ -1245,8 +1244,7 @@ sgetc(int noblock)
/* see if there is data from the keyboard available either from */
/* the keyboard fifo or from the 8042 keyboard controller */
if ((noblock && pcvt_kbd_count) ||
((!noblock || kbd_polling) && (inb(CONTROLLER_CTRL) & STATUS_OUTPBF)))
if (pcvt_kbd_count || (inb(CONTROLLER_CTRL) & STATUS_OUTPBF))
{
if (!noblock || kbd_polling) /* source = 8042 */
{