summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-10-29 06:12:47 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-10-29 06:12:47 +0800
commit05ea972fbe7a9ba1f3fbe54a590ac4ea89c1d67f (patch)
treec3074745aa8cfb15f3e24407b5746c33221165f1
parent1e68e44ea1fe6321e6153aef4ff96533c9c2d4c5 (diff)
downloadpttbbs-05ea972fbe7a9ba1f3fbe54a590ac4ea89c1d67f.tar
pttbbs-05ea972fbe7a9ba1f3fbe54a590ac4ea89c1d67f.tar.gz
pttbbs-05ea972fbe7a9ba1f3fbe54a590ac4ea89c1d67f.tar.bz2
pttbbs-05ea972fbe7a9ba1f3fbe54a590ac4ea89c1d67f.tar.lz
pttbbs-05ea972fbe7a9ba1f3fbe54a590ac4ea89c1d67f.tar.xz
pttbbs-05ea972fbe7a9ba1f3fbe54a590ac4ea89c1d67f.tar.zst
pttbbs-05ea972fbe7a9ba1f3fbe54a590ac4ea89c1d67f.zip
* make pager hotkey processing independent from io.c input API
git-svn-id: http://opensvn.csie.org/pttbbs/trunk@5007 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--pttbbs/include/proto.h4
-rw-r--r--pttbbs/mbbsd/io.c26
2 files changed, 17 insertions, 13 deletions
diff --git a/pttbbs/include/proto.h b/pttbbs/include/proto.h
index 4828c6a3..3cf1849d 100644
--- a/pttbbs/include/proto.h
+++ b/pttbbs/include/proto.h
@@ -276,6 +276,9 @@ int ochar(int c);
void output(const char *s, int len);
void oflush(void);
+// pager hotkeys processor
+int process_pager_keys(int ch);
+
// input api (old flavor)
int num_in_buf(void);
int wait_input(float f, int bIgnoreBuf);
@@ -293,6 +296,7 @@ int vkey_detach(void); // works like to add_io(0, 0)
int vkey_attach(int fd); // works like add_io(fd, ...)
int vkey_is_ready(); // works like (num_in_buf() > 0)
+
/* kaede */
char*Ptt_prints(char *str, size_t size, int mode);
void outmsg(const char *msg);
diff --git a/pttbbs/mbbsd/io.c b/pttbbs/mbbsd/io.c
index dca4381e..b2ae0975 100644
--- a/pttbbs/mbbsd/io.c
+++ b/pttbbs/mbbsd/io.c
@@ -198,11 +198,11 @@ ochar(int c)
/* pager processor */
/* ----------------------------------------------------- */
-static int i_newfd;
+static int i_newfd; // forward declaration
int
process_pager_keys(int ch)
{
- static int water_which_flag;
+ static int water_which_flag = 0;
assert(currutmp);
switch (ch)
{
@@ -213,17 +213,14 @@ process_pager_keys(int ch)
return ch;
} else {
screen_backup_t old_screen;
- int oldroll = roll;
int my_newfd;
scr_dump(&old_screen);
- my_newfd = i_newfd;
- i_newfd = 0;
+ my_newfd = vkey_detach();
t_users();
- i_newfd = my_newfd;
- roll = oldroll;
+ vkey_attach(my_newfd);
scr_restore(&old_screen);
}
return KEY_INCOMPLETE;
@@ -242,11 +239,10 @@ process_pager_keys(int ch)
scr_dump(&old_screen);
- my_newfd = i_newfd;
- i_newfd = 0;
+ my_newfd = vkey_detach();
my_write2();
scr_restore(&old_screen);
- i_newfd = my_newfd;
+ vkey_attach(my_newfd);
return KEY_INCOMPLETE;
}
@@ -280,8 +276,7 @@ process_pager_keys(int ch)
scr_dump(&old_screen);
/* 如果正在talk的話先不處理對方送過來的封包 (不去select) */
- my_newfd = i_newfd;
- i_newfd = 0;
+ my_newfd = vkey_detach();
show_call_in(0, 0);
watermode = 0;
#ifndef PLAY_ANGEL
@@ -304,7 +299,7 @@ process_pager_keys(int ch)
break;
}
#endif
- i_newfd = my_newfd;
+ vkey_attach(my_newfd);
/* 還原螢幕 */
scr_restore(&old_screen);
@@ -643,10 +638,15 @@ wait_input(float f, int bIgnoreBuf)
return 1;
}
+inline int peek_input(float f, int c); // forward declaration
+
inline void
vkey_purge(void)
{
icurrchar = ibufsize = 0;
+ // XXX read more from fd and discard...
+ peek_input(0.1, Ctrl('C'));
+ icurrchar = ibufsize = 0;
}
int