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 /common/sys | |
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 'common/sys')
-rw-r--r-- | common/sys/telnet.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/common/sys/telnet.c b/common/sys/telnet.c index 14b39c39..b0c5f1d7 100644 --- a/common/sys/telnet.c +++ b/common/sys/telnet.c @@ -46,9 +46,9 @@ void telnet_ctx_init(TelnetCtx *ctx, const struct TelnetCallback *callback, int ctx->fd = fd; } -void telnet_ctx_set_ccctx(TelnetCtx *ctx, void *ccctx) +void telnet_ctx_set_cc_arg(TelnetCtx *ctx, void *cc_arg) { - ctx->ccctx = ccctx; + ctx->cc_arg = cc_arg; } /* We are the boss. We don't respect to client. @@ -119,15 +119,15 @@ telnet_handler(TelnetCtx *ctx, unsigned char c) } /* hash client telnet sequences */ - if (ctx->ccctx && ctx->callback->update_client_code) { + if (ctx->cc_arg && ctx->callback->update_client_code) { void (*cb)(void *, unsigned char) = ctx->callback->update_client_code; if(ctx->iac_state == IAC_WAIT_SE) { // skip suboption } else { if(ctx->iac_quote) - cb(ctx->ccctx, IAC); - cb(ctx->ccctx, c); + cb(ctx->cc_arg, IAC); + cb(ctx->cc_arg, c); } } @@ -301,38 +301,38 @@ telnet_handler(TelnetCtx *ctx, unsigned char c) int w = (ctx->iac_buf[1] << 8) + (ctx->iac_buf[2]); int h = (ctx->iac_buf[3] << 8) + (ctx->iac_buf[4]); if (ctx->callback->term_resize) - ctx->callback->term_resize(w, h); - if (ctx->ccctx && + ctx->callback->term_resize(ctx->resize_arg, w, h); + if (ctx->cc_arg && ctx->callback->update_client_code) { void (*cb)(void *, unsigned char) = ctx->callback->update_client_code; - cb(ctx->ccctx, ctx->iac_buf[0]); + cb(ctx->cc_arg, ctx->iac_buf[0]); if(w==80 && h==24) - cb(ctx->ccctx, 1); + cb(ctx->cc_arg, 1); else if(w==80) - cb(ctx->ccctx, 2); + cb(ctx->cc_arg, 2); else if(h==24) - cb(ctx->ccctx, 3); + cb(ctx->cc_arg, 3); else - cb(ctx->ccctx, 4); - cb(ctx->ccctx, IAC); - cb(ctx->ccctx, SE); + cb(ctx->cc_arg, 4); + cb(ctx->cc_arg, IAC); + cb(ctx->cc_arg, SE); } } break; default: - if (ctx->ccctx && + if (ctx->cc_arg && ctx->callback->update_client_code) { void (*cb)(void *, unsigned char) = ctx->callback->update_client_code; int i; for(i=0;i<ctx->iac_buflen;i++) - cb(ctx->ccctx, ctx->iac_buf[i]); - cb(ctx->ccctx, IAC); - cb(ctx->ccctx, SE); + cb(ctx->cc_arg, ctx->iac_buf[i]); + cb(ctx->cc_arg, IAC); + cb(ctx->cc_arg, SE); } break; } |