summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-06-08 20:23:45 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-06-08 20:23:45 +0800
commit49ab5387843086e5051f260870022eaeb1907a7a (patch)
tree20e52482a8c3af0e2e7d9e0ab7bf919303fd288e
parent16dfdf20bdcc4cb009c3623a86f4b039ffb7e468 (diff)
downloadpttbbs-49ab5387843086e5051f260870022eaeb1907a7a.tar
pttbbs-49ab5387843086e5051f260870022eaeb1907a7a.tar.gz
pttbbs-49ab5387843086e5051f260870022eaeb1907a7a.tar.bz2
pttbbs-49ab5387843086e5051f260870022eaeb1907a7a.tar.lz
pttbbs-49ab5387843086e5051f260870022eaeb1907a7a.tar.xz
pttbbs-49ab5387843086e5051f260870022eaeb1907a7a.tar.zst
pttbbs-49ab5387843086e5051f260870022eaeb1907a7a.zip
make new seq parser more robust
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2806 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--include/common.h1
-rw-r--r--mbbsd/io.c10
2 files changed, 10 insertions, 1 deletions
diff --git a/include/common.h b/include/common.h
index efc68352..430f72d7 100644
--- a/include/common.h
+++ b/include/common.h
@@ -154,6 +154,7 @@ ANSI_COLOR(34;46) " ÂE¶­©¹ªð " ANSI_COLOR(31;47) "(R)" ANSI_COLOR(30) "¦^«H" ANS
#define KEY_F10 0x030A
#define KEY_F11 0x030B
#define KEY_F12 0x030C
+#define KEY_UNKNOWN 0x0FFF /* unknown sequence */
#define QCAST int (*)(const void *, const void *)
#define Ctrl(c) (c & 037)
diff --git a/mbbsd/io.c b/mbbsd/io.c
index 8f44087b..a57d005c 100644
--- a/mbbsd/io.c
+++ b/mbbsd/io.c
@@ -270,10 +270,13 @@ igetch(void)
else if(ch == 'Z')
{
return KEY_STAB;
- } else if (ch == '0')
+ }
+ else if (ch == '0')
{
if (dogetch() == 'Z')
return KEY_STAB;
+ else
+ return KEY_UNKNOWN;
}
}
else if (mode == 3)
@@ -295,6 +298,7 @@ igetch(void)
dogetch(); /* must be '~' */
return KEY_F6 + ch - '7';
}
+ else return KEY_UNKNOWN;
} else if (last == '2')
{
if (ch >= '0' && ch <= '4')
@@ -302,15 +306,19 @@ igetch(void)
dogetch(); /* hope you are '~' */
return KEY_F9 + ch - '0';
}
+ else return KEY_UNKNOWN;
}
}
else if(mode == 4)
{
/* ^[O ... */
+ if (ch >= 'A' && ch <= 'D')
+ return KEY_UP + (ch - 'A');
if (ch >= 'p' && ch <= 'z')
return KEY_F1 + (ch - 'p');
else if (ch == 'a')
return KEY_F12;
+ else return KEY_UNKNOWN;
}
else // here is switch for default keys
switch (ch) { // XXX: indent error