From 3cbefc4792908b0b0f7433f6565958032e01b241 Mon Sep 17 00:00:00 2001 From: scw Date: Tue, 29 Jun 2004 09:34:56 +0000 Subject: Check window size in telnet. git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2100 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/term.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/mbbsd/term.c b/mbbsd/term.c index f58bbfb8..3d9fd793 100644 --- a/mbbsd/term.c +++ b/mbbsd/term.c @@ -52,9 +52,14 @@ outcf(int ch) } #endif -static void +static inline void term_resize(int row, int col){ screenline_t *new_picture; + + /* make sure reasonable size */ + row = MAX(24, MIN(100, row)); + col = MAX(80, MIN(200, col)); + if (big_picture != NULL && row > t_lines) { new_picture = (screenline_t *) calloc(row, sizeof(screenline_t)); if (new_picture == NULL) { @@ -79,10 +84,6 @@ term_resize_catch(int sig) signal(SIGWINCH, SIG_IGN); /* Don't bother me! */ ioctl(0, TIOCGWINSZ, &newsize); - /* make sure reasonable size */ - newsize.ws_row = MAX(24, MIN(100, newsize.ws_row)); - newsize.ws_col = MAX(80, MIN(200, newsize.ws_col)); - term_resize(newsize.ws_row, newsize.ws_col); signal(SIGWINCH, term_resize_catch); -- cgit v1.2.3