-
-/* this routine should be called after receiving SIGWINCH */
-void mutt_resize_screen (void)
-{
- char *cp;
- int fd;
- struct winsize w;
-
- int rows, cols;
-
- rows = -1;
- cols = -1;
- if ((fd = open ("/dev/tty", O_RDONLY)) != -1) {
- if (ioctl (fd, TIOCGWINSZ, &w) != -1) {
- rows = w.ws_row;
- cols = w.ws_col;
- }
- close (fd);
- }
- if (rows <= 0) {
- if ((cp = getenv ("LINES")) != NULL) {
- rows = atoi (cp);
- }
- else
- rows = 24;
- }
- if (cols <= 0) {
- if ((cp = getenv ("COLUMNS")) != NULL)
- cols = atoi (cp);
- else
- cols = 80;
- }
- resizeterm (rows, cols);
-}