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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
20 #include "mutt_curses.h"
27 #ifdef HAVE_SYS_IOCTL_H
28 #include <sys/ioctl.h>
35 /* this routine should be called after receiving SIGWINCH */
36 void mutt_resize_screen (void)
41 #ifdef HAVE_RESIZETERM
42 int SLtt_Screen_Rows, SLtt_Screen_Cols;
45 SLtt_Screen_Rows = -1;
46 SLtt_Screen_Cols = -1;
47 if ((fd = open ("/dev/tty", O_RDONLY)) != -1)
49 if (ioctl (fd, TIOCGWINSZ, &w) != -1)
51 SLtt_Screen_Rows = w.ws_row;
52 SLtt_Screen_Cols = w.ws_col;
56 if (SLtt_Screen_Rows <= 0)
58 if ((cp = getenv ("LINES")) != NULL)
60 SLtt_Screen_Rows = atoi (cp);
63 SLtt_Screen_Rows = 24;
65 if (SLtt_Screen_Cols <= 0)
67 if ((cp = getenv ("COLUMNS")) != NULL)
68 SLtt_Screen_Cols = atoi (cp);
70 SLtt_Screen_Cols = 80;
72 #ifdef USE_SLANG_CURSES
76 stdscr = newwin (0, 0, 0, 0);
77 keypad (stdscr, TRUE);
79 resizeterm (SLtt_Screen_Rows, SLtt_Screen_Cols);