diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2009-06-07 21:26:35 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2009-06-07 21:26:35 +0800 |
commit | 989b11cc9a64f74cf2ae3a81a92610e680b4e591 (patch) | |
tree | 407451980e091a2f8de82f8c2bcc9e11a7b885c1 /mbbsd/telnet.c | |
parent | 459efa8f9a52ed599c4802bd0ed698ffe31c1bef (diff) | |
download | pttbbs-989b11cc9a64f74cf2ae3a81a92610e680b4e591.tar pttbbs-989b11cc9a64f74cf2ae3a81a92610e680b4e591.tar.gz pttbbs-989b11cc9a64f74cf2ae3a81a92610e680b4e591.tar.bz2 pttbbs-989b11cc9a64f74cf2ae3a81a92610e680b4e591.tar.lz pttbbs-989b11cc9a64f74cf2ae3a81a92610e680b4e591.tar.xz pttbbs-989b11cc9a64f74cf2ae3a81a92610e680b4e591.tar.zst pttbbs-989b11cc9a64f74cf2ae3a81a92610e680b4e591.zip |
* change telnet interface to accept extra parameter for callbacks (*_arg)
* refine mbbsd to allow pre-setting terminal window
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4514 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/telnet.c')
-rw-r--r-- | mbbsd/telnet.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/mbbsd/telnet.c b/mbbsd/telnet.c index 45f000a7..f348f08c 100644 --- a/mbbsd/telnet.c +++ b/mbbsd/telnet.c @@ -6,14 +6,21 @@ static char raw_connection = 0; #ifdef DETECT_CLIENT extern void UpdateClientCode(unsigned char c); -void telnet_cb_update_client_code(void *ccctx, unsigned char c) +static void +telnet_cb_update_client_code(void *cc_arg, unsigned char c) { UpdateClientCode(c); } #endif +static void +telnet_cb_resize_term(void *resize_arg, int w, int h) +{ + term_resize(w, h); +} + const static struct TelnetCallback telnet_callback = { - term_resize, + telnet_cb_resize_term, #ifdef DETECT_CLIENT telnet_cb_update_client_code, #else @@ -22,16 +29,17 @@ const static struct TelnetCallback telnet_callback = { }; void -telnet_init(void) +telnet_init(int do_init_cmd) { int fd = 0; TelnetCtx *ctx = &telnet_ctx; raw_connection = 1; telnet_ctx_init(ctx, &telnet_callback, fd); #ifdef DETECT_CLIENT - telnet_ctx_set_ccctx(ctx, (void*)1); + telnet_ctx_set_cc_arg(ctx, (void*)1); #endif - telnet_send_init_cmds(fd); + if (do_init_cmd) + telnet_send_init_cmds(fd); } /* tty_read @@ -58,7 +66,7 @@ void telnet_turnoff_client_detect(void) { TelnetCtx *ctx = &telnet_ctx; - telnet_ctx_set_ccctx(ctx, NULL); + telnet_ctx_set_cc_arg(ctx, NULL); } // vim: sw=4 |