diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2008-01-19 00:02:22 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2008-01-19 00:02:22 +0800 |
commit | 01cb925740f158ccd6ce7f48302080867a09a0ac (patch) | |
tree | 90faab403e779ce99c523b84237fedb3e7faf8b7 /mbbsd | |
parent | b7bba29130f01b78922ff4d8f71fc93646a0dbdb (diff) | |
download | pttbbs-01cb925740f158ccd6ce7f48302080867a09a0ac.tar pttbbs-01cb925740f158ccd6ce7f48302080867a09a0ac.tar.gz pttbbs-01cb925740f158ccd6ce7f48302080867a09a0ac.tar.bz2 pttbbs-01cb925740f158ccd6ce7f48302080867a09a0ac.tar.lz pttbbs-01cb925740f158ccd6ce7f48302080867a09a0ac.tar.xz pttbbs-01cb925740f158ccd6ce7f48302080867a09a0ac.tar.zst pttbbs-01cb925740f158ccd6ce7f48302080867a09a0ac.zip |
- improve input system logic
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3842 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r-- | mbbsd/io.c | 14 | ||||
-rw-r--r-- | mbbsd/telnet.c | 4 |
2 files changed, 17 insertions, 1 deletions
@@ -165,6 +165,8 @@ add_io(int fd, int timeout) int num_in_buf(void) { + if (ibufsize <= icurrchar) + return 0; return ibufsize - icurrchar; } @@ -267,6 +269,15 @@ dogetch(void) currutmp->lastact = now; lastact = now; } + + // CR LF are treated as one. + if (inbuf[icurrchar] == Ctrl('M')) + { + if (++icurrchar < ibufsize && + inbuf[icurrchar] == Ctrl('J')) + icurrchar ++; + return Ctrl('M'); + } return (unsigned char)inbuf[icurrchar++]; } @@ -626,6 +637,8 @@ igetch(void) } return ch; + // try to do this in getch() level. +#if 0 case Ctrl('J'): /* Ptt §â \n ®³±¼ */ #ifdef PLAY_ANGEL /* Seams some telnet client still send CR LF when changing lines. @@ -633,6 +646,7 @@ igetch(void) */ #endif continue; +#endif default: return ch; diff --git a/mbbsd/telnet.c b/mbbsd/telnet.c index 4f4bba0b..332b3f3a 100644 --- a/mbbsd/telnet.c +++ b/mbbsd/telnet.c @@ -164,7 +164,9 @@ telnet_handler(unsigned char c) iac_state = IAC_NONE; /* by default we restore state. */ switch(c) { case IAC: - return 0; + // return 0; + // we don't want to allow IACs as input. + return 1; /* we don't want to process these. or maybe in future. */ case BREAK: /* break */ |