2 * Copyright notice from original mutt:
3 * Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
5 * This file is part of mutt-ng, see http://www.muttng.org/.
6 * It's licensed under the GNU General Public License,
7 * please see the file GPL in the top level source directory.
15 #include "mutt_curses.h"
22 #ifdef HAVE_SYS_IOCTL_H
23 #include <sys/ioctl.h>
30 /* this routine should be called after receiving SIGWINCH */
31 void mutt_resize_screen (void)
37 #ifdef HAVE_RESIZETERM
38 int SLtt_Screen_Rows, SLtt_Screen_Cols;
41 SLtt_Screen_Rows = -1;
42 SLtt_Screen_Cols = -1;
43 if ((fd = open ("/dev/tty", O_RDONLY)) != -1) {
44 if (ioctl (fd, TIOCGWINSZ, &w) != -1) {
45 SLtt_Screen_Rows = w.ws_row;
46 SLtt_Screen_Cols = w.ws_col;
50 if (SLtt_Screen_Rows <= 0) {
51 if ((cp = getenv ("LINES")) != NULL) {
52 SLtt_Screen_Rows = atoi (cp);
55 SLtt_Screen_Rows = 24;
57 if (SLtt_Screen_Cols <= 0) {
58 if ((cp = getenv ("COLUMNS")) != NULL)
59 SLtt_Screen_Cols = atoi (cp);
61 SLtt_Screen_Cols = 80;
63 #ifdef USE_SLANG_CURSES
67 stdscr = newwin (0, 0, 0, 0);
68 keypad (stdscr, TRUE);
70 resizeterm (SLtt_Screen_Rows, SLtt_Screen_Cols);