From 3e667e8bf274223b49012acc74707b3651668fe3 Mon Sep 17 00:00:00 2001 From: kcwu Date: Wed, 11 Sep 2002 07:16:49 +0000 Subject: not only long screen, but also width screen git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@518 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/term.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'mbbsd/term.c') diff --git a/mbbsd/term.c b/mbbsd/term.c index f5b2544b..ed112346 100644 --- a/mbbsd/term.c +++ b/mbbsd/term.c @@ -1,4 +1,4 @@ -/* $Id: term.c,v 1.9 2002/08/25 11:40:16 kcwu Exp $ */ +/* $Id: term.c,v 1.10 2002/09/11 07:16:49 kcwu Exp $ */ #include "bbs.h" int tgetent(const char *bp, char *name); @@ -60,6 +60,11 @@ term_resize(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)); + if (newsize.ws_row > t_lines) { new_picture = (screenline_t *) calloc(newsize.ws_row, sizeof(screenline_t)); @@ -72,6 +77,7 @@ term_resize(int sig) big_picture = new_picture; } t_lines = newsize.ws_row; + t_columns = newsize.ws_col; scr_lns = t_lines; /* XXX: scr_lns 跟 t_lines 有什麼不同, 為何分成兩個 */ b_lines = t_lines - 1; p_lines = t_lines - 4; -- cgit v1.2.3