summaryrefslogtreecommitdiffstats
path: root/mbbsd/io.c
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-01-11 01:15:29 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-01-11 01:15:29 +0800
commitc1adbe09c64e8e252d0d1cfde149be2fd5f31db0 (patch)
tree79367e5539ff69e758ceed7b78619d9e8ae9c2d4 /mbbsd/io.c
parent0d0b63801e05a329e97aa1756d1920f9f47ca134 (diff)
downloadpttbbs-c1adbe09c64e8e252d0d1cfde149be2fd5f31db0.tar
pttbbs-c1adbe09c64e8e252d0d1cfde149be2fd5f31db0.tar.gz
pttbbs-c1adbe09c64e8e252d0d1cfde149be2fd5f31db0.tar.bz2
pttbbs-c1adbe09c64e8e252d0d1cfde149be2fd5f31db0.tar.lz
pttbbs-c1adbe09c64e8e252d0d1cfde149be2fd5f31db0.tar.xz
pttbbs-c1adbe09c64e8e252d0d1cfde149be2fd5f31db0.tar.zst
pttbbs-c1adbe09c64e8e252d0d1cfde149be2fd5f31db0.zip
- bbslua: enable ^C to break <workaround>
- TODO: enable ungetch() someday. git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3818 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/io.c')
-rw-r--r--mbbsd/io.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/mbbsd/io.c b/mbbsd/io.c
index 64d5b1a1..cd2388ec 100644
--- a/mbbsd/io.c
+++ b/mbbsd/io.c
@@ -778,6 +778,14 @@ oldgetdata(int line, int col, const char *prompt, char *buf, int len, int echo)
len--;
clen = 0;
while ((ch = igetch()) != '\r') {
+ if (ch == Ctrl('C'))
+ {
+ // abort
+ clen = 0;
+ if (len > 1)
+ buf[1] = ch; // workaround for BBS-Lua
+ break;
+ }
if (ch == '\177' || ch == Ctrl('H')) {
if (!clen) {
bell();
@@ -822,6 +830,15 @@ oldgetdata(int line, int col, const char *prompt, char *buf, int len, int echo)
if ((ch = igetch()) == '\r')
break;
+ if (ch == Ctrl('C'))
+ {
+ // abort
+ clen = currchar = 0;
+ if (len > 1)
+ buf[1] = ch; // workaround for BBS-Lua
+ break;
+ }
+
switch (ch) {
case Ctrl('A'):
case KEY_HOME: