diff options
-rw-r--r-- | pttbbs/include/proto.h | 4 | ||||
-rw-r--r-- | pttbbs/mbbsd/ccw.c | 12 | ||||
-rw-r--r-- | pttbbs/mbbsd/ch_dark.c | 2 | ||||
-rw-r--r-- | pttbbs/mbbsd/chess.c | 2 | ||||
-rw-r--r-- | pttbbs/mbbsd/io.c | 8 | ||||
-rw-r--r-- | pttbbs/mbbsd/talk.c | 2 |
6 files changed, 19 insertions, 11 deletions
diff --git a/pttbbs/include/proto.h b/pttbbs/include/proto.h index 0c20ff4e..f0a7e6ba 100644 --- a/pttbbs/include/proto.h +++ b/pttbbs/include/proto.h @@ -289,8 +289,8 @@ void add_io(int fd, int timeout); int vkey(); // identical to igetch void vkey_flush(); // identical to drop_input int vkey_is_full(); // identical to input_isfull -int vkey_detach(void); // works like to add_io(0, 0) -// int vkey_attach(int fd); // works like add_io(fd, ...) +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 */ diff --git a/pttbbs/mbbsd/ccw.c b/pttbbs/mbbsd/ccw.c index 86f6cb0b..69a747d2 100644 --- a/pttbbs/mbbsd/ccw.c +++ b/pttbbs/mbbsd/ccw.c @@ -360,7 +360,7 @@ ccw_vgetcb_peek(int key, VGET_RUNTIME *prt GCC_UNUSED, void *instance) fflush(ctx->log); more(ctx->log_fpath, YEA); - add_io(ctx->fd, 0); + vkey_attach(ctx->fd); vscr_restore(scr); } return VGETCB_NEXT; @@ -373,7 +373,7 @@ ccw_vgetcb_peek(int key, VGET_RUNTIME *prt GCC_UNUSED, void *instance) if (vans("確定要離開嗎? [y/N]: ") == 'y') ctx->abort = YEA; - add_io(ctx->fd, 0); + vkey_attach(ctx->fd); vscr_restore(scr); // ccw_footer(ctx); } @@ -691,7 +691,7 @@ ccw_talk(int fd, int destuid) fprintf(ctx.log, "[%s] 與 %s " CCW_CAP_TALK ":\n", Cdatelite(&now), ctx.remote_id); // main processor - add_io(fd, 0); + vkey_attach(fd); ccw_process(&ctx); // clean network resource @@ -805,7 +805,7 @@ ccw_chat_footer(CCW_CTX *ctx) ZA_Enter(); - add_io(ctx->fd, 0); + vkey_attach(ctx->fd); vscr_restore(scr); } @@ -1146,7 +1146,7 @@ ccw_chat_peek_key(CCW_CTX *ctx, int key) vkey_detach(); za = ZA_Select(); ccw_footer(ctx); - add_io(ctx->fd, 0); + vkey_attach(ctx->fd); vcur_restore(cur); if (za) ctx->abort_vget = 1; @@ -1237,7 +1237,7 @@ ccw_chat(int fd) fprintf(ctx.log, "[%s] 進入" CCW_CAP_CHAT ":\n", Cdatelite(&now)); // main processor - add_io(fd, 0); + vkey_attach(fd); ccw_process(&ctx); // clean network resource diff --git a/pttbbs/mbbsd/ch_dark.c b/pttbbs/mbbsd/ch_dark.c index e6a16f6d..dc35b1df 100644 --- a/pttbbs/mbbsd/ch_dark.c +++ b/pttbbs/mbbsd/ch_dark.c @@ -398,7 +398,7 @@ main_dark(int fd, userinfo_t * uin) if (currutmp->turn) move(cury[0], curx[0]); - add_io(fd, 0); + vkey_attach(fd); while (end <= 0) { if (uin->turn == 'w' || currutmp->turn == 'w') { end = -1; diff --git a/pttbbs/mbbsd/chess.c b/pttbbs/mbbsd/chess.c index 6fa18627..daf385ae 100644 --- a/pttbbs/mbbsd/chess.c +++ b/pttbbs/mbbsd/chess.c @@ -23,7 +23,7 @@ #define CHESS_DRAWING_PHOTOED_TIME_ROW2 21 #define CHESS_DRAWING_PHOTOED_WARN_ROW 22 -#define CONNECT_PEER() add_io(info->sock, 0) +#define CONNECT_PEER() vkey_attach(info->sock) #define IGNORE_PEER() vkey_detach() #define DO_WITHOUT_PEER(TIMEOUT,ACT,ELSE) \ diff --git a/pttbbs/mbbsd/io.c b/pttbbs/mbbsd/io.c index f21afe7c..8e8c06b0 100644 --- a/pttbbs/mbbsd/io.c +++ b/pttbbs/mbbsd/io.c @@ -651,6 +651,14 @@ vkey_detach(void) return r; } +int +vkey_attach(int fd) +{ + int r = i_newfd; + add_io(fd, 0); + return r; +} + /* * wait user input for f seconds. * return 1 if control key c is available. diff --git a/pttbbs/mbbsd/talk.c b/pttbbs/mbbsd/talk.c index 21f7fbea..bd02a86d 100644 --- a/pttbbs/mbbsd/talk.c +++ b/pttbbs/mbbsd/talk.c @@ -1393,7 +1393,7 @@ my_talk(userinfo_t * uin, int fri_stat, char defact) uin->sig == SIG_GO || uin->sig == SIG_REVERSI) ChessEstablishRequest(msgsock); - add_io(msgsock, 0); + vkey_attach(msgsock); while ((ch = vkey()) != I_OTHERDATA) { if (ch == Ctrl('D')) { vkey_detach(); |