summaryrefslogtreecommitdiffstats
path: root/mbbsd/mbbsd.c
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-06-07 21:26:35 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-06-07 21:26:35 +0800
commit989b11cc9a64f74cf2ae3a81a92610e680b4e591 (patch)
tree407451980e091a2f8de82f8c2bcc9e11a7b885c1 /mbbsd/mbbsd.c
parent459efa8f9a52ed599c4802bd0ed698ffe31c1bef (diff)
downloadpttbbs-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/mbbsd.c')
-rw-r--r--mbbsd/mbbsd.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c
index a66767a9..ff9188d8 100644
--- a/mbbsd/mbbsd.c
+++ b/mbbsd/mbbsd.c
@@ -47,6 +47,7 @@ struct ProgramOption {
bool daemon_mode;
bool tunnel_mode;
enum TermMode term_mode;
+ int term_width, term_height;
int nport;
int port[MAX_BINDPORT];
int flag_listenfd;
@@ -1386,10 +1387,18 @@ do_aloha(const char *hello)
}
static void
-do_term_init(enum TermMode term_mode)
+do_term_init(enum TermMode term_mode, int w, int h)
{
term_init();
initscr();
+
+ // if the terminal was already determined, resize for it.
+ if ((w && (w != t_columns)) ||
+ (h && (h != t_lines )) )
+ {
+ term_resize(w, h);
+ }
+
if (term_mode == TermMode_TTY)
raise(SIGWINCH);
}
@@ -1737,7 +1746,8 @@ main(int argc, char *argv[], char *envp[])
return 0;
}
- do_term_init(option->term_mode);
+ do_term_init(option->term_mode,
+ option->term_width, option->term_height);
start_client(option);
free_program_option(option);
@@ -1867,8 +1877,9 @@ tunnel_login(char *argv0, struct ProgramOption *option)
strlcpy(option->flag_user, dat.userid, sizeof(option->flag_user));
if (dat.encoding)
set_converting_type(dat.encoding);
- resizeterm(dat.t_lines, dat.t_cols);
- telnet_init();
+ option->term_width = dat.t_cols;
+ option->term_height = dat.t_lines;
+ telnet_init(0);
return 1;
}
@@ -1996,7 +2007,7 @@ daemon_login(char *argv0, struct ProgramOption *option)
sleep(10);
exit(0);
}
- telnet_init();
+ telnet_init(1);
return 1;
}