--- lbbs/src/io.c 2004/10/23 18:41:41 1.2 +++ lbbs/src/io.c 2005/03/02 16:33:49 1.4 @@ -25,7 +25,7 @@ outc(char c) { int retval; - retval = printf("%c",c); + retval = fprintf(stdout, "%c", c); return retval; } @@ -56,10 +56,10 @@ iflush() int igetch () { - char c, tmp[256]; static char buf[256]; - int out = 0, loop = 1, in_esc = 0, in_ascii = 0, i = 0, j; - static int len =0 , pos = 0; + unsigned char c, tmp[256]; + int out = 0, loop = 1, in_esc = 0, in_ascii = 0, in_control = 0, i = 0, j; + static int len = 0 , pos = 0; if (pos >= len) { @@ -67,8 +67,8 @@ igetch () pos = 0; //For debug - //for (j = 0; j < len; j++) - // log_std ("[%d]\n", buf[j]); + for (j = 0; j < len; j++) + log_std ("<--[%u]\n", (buf[j] + 256) % 256); } while (pos < len) @@ -81,6 +81,28 @@ igetch () break; } + if (c == KEY_CONTROL) + { + if (in_control == 0) + { + in_control = 1; + i = 0; + continue; + } + } + + if (in_control) + { + tmp[i++] = c; + if (i >= 2) + { + out = (int)tmp[0] * 256 + tmp[1]; + in_control = 0; + break; + } + continue; + } + if (c == ESC_KEY) { if (in_esc == 0) @@ -136,6 +158,9 @@ igetch () case 49: out = KEY_HOME; break; + case 51: + out = KEY_DEL; + break; case 52: out = KEY_END; break; @@ -156,7 +181,7 @@ igetch () } //for debug - //log_std ("[%d]\n", out); + log_std ("-->[%u]\n", out); return out; }