summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorscw <scw@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-06-29 17:34:56 +0800
committerscw <scw@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-06-29 17:34:56 +0800
commit3cbefc4792908b0b0f7433f6565958032e01b241 (patch)
tree5d881d55905859e578d8e642f74a08db8699d473
parent8ccbb616dd0471aca56c5fafc4612011876d6772 (diff)
downloadpttbbs-3cbefc4792908b0b0f7433f6565958032e01b241.tar
pttbbs-3cbefc4792908b0b0f7433f6565958032e01b241.tar.gz
pttbbs-3cbefc4792908b0b0f7433f6565958032e01b241.tar.bz2
pttbbs-3cbefc4792908b0b0f7433f6565958032e01b241.tar.lz
pttbbs-3cbefc4792908b0b0f7433f6565958032e01b241.tar.xz
pttbbs-3cbefc4792908b0b0f7433f6565958032e01b241.tar.zst
pttbbs-3cbefc4792908b0b0f7433f6565958032e01b241.zip
Check window size in telnet.scw.telnet@2100
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2100 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/term.c11
1 files 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);