2 * Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 #include "mutt_curses.h"
31 #ifdef HAVE_SYS_IOCTL_H
32 #include <sys/ioctl.h>
39 /* this routine should be called after receiving SIGWINCH */
40 void mutt_resize_screen (void)
45 #ifdef HAVE_RESIZETERM
46 int SLtt_Screen_Rows, SLtt_Screen_Cols;
49 SLtt_Screen_Rows = -1;
50 SLtt_Screen_Cols = -1;
51 if ((fd = open ("/dev/tty", O_RDONLY)) != -1)
53 if (ioctl (fd, TIOCGWINSZ, &w) != -1)
55 SLtt_Screen_Rows = w.ws_row;
56 SLtt_Screen_Cols = w.ws_col;
60 if (SLtt_Screen_Rows <= 0)
62 if ((cp = getenv ("LINES")) != NULL)
64 SLtt_Screen_Rows = atoi (cp);
67 SLtt_Screen_Rows = 24;
69 if (SLtt_Screen_Cols <= 0)
71 if ((cp = getenv ("COLUMNS")) != NULL)
72 SLtt_Screen_Cols = atoi (cp);
74 SLtt_Screen_Cols = 80;
76 #ifdef USE_SLANG_CURSES
80 stdscr = newwin (0, 0, 0, 0);
81 keypad (stdscr, TRUE);
83 resizeterm (SLtt_Screen_Rows, SLtt_Screen_Cols);