From: Ben Gras Date: Wed, 4 Feb 2009 17:30:01 +0000 (+0000) Subject: simplified the code a little, corrected some hasty statements. X-Git-Tag: v3.1.4~116 X-Git-Url: http://zhaoyanbai.com/repos/Bv9ARM.ch05.html?a=commitdiff_plain;h=bb18be5d06249cac8a25a84e98e19f1d9fbaea25;p=minix.git simplified the code a little, corrected some hasty statements. --- diff --git a/drivers/tty/keyboard.c b/drivers/tty/keyboard.c index 5e093574e..d0e9fdcaf 100644 --- a/drivers/tty/keyboard.c +++ b/drivers/tty/keyboard.c @@ -454,13 +454,6 @@ message *m; } -/*===========================================================================* - * map_key0 * - *===========================================================================*/ -/* Map a scan code to an ASCII code ignoring modifiers. */ -#define map_key0(scode) \ - ((unsigned) keymap[(scode) * MAP_COLS]) - /*===========================================================================* * map_key * *===========================================================================*/ @@ -472,12 +465,10 @@ int scode; int caps, column, lk; u16_t *keyrow; - if (scode == SLASH_SCAN && esc) return '/'; /* don't map numeric slash */ - if(esc) - keyrow = &keymap[scode * MAP_COLS]; - else keyrow = &keymap_escaped[scode * MAP_COLS]; + else + keyrow = &keymap[scode * MAP_COLS]; caps = shift; lk = locks[ccurrent]; @@ -771,12 +762,13 @@ int scode; /* scan code of key just struck or released */ esc = 1; /* Next key is escaped */ return(-1); default: /* A normal key */ - if(!ch) { - printf("tty: ignoring unrecognized %s scancode 0x%x\n", - esc ? "escaped" : "straight", scode); - return -1; - } - if(make) return(ch); + if(!make) + return -1; + if(ch) + return ch; + printf("tty: ignoring unrecognized %s scancode 0x%x\n", + escape ? "escaped" : "straight", scode); + return -1; } /* Key release, or a shift type key. */