ubuntuusers.de

Titel:
Unbenannt
Autor:
sebix
Datum:
1. Januar 2017 16:50
Aktionen:
Code:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
void handle_sigwinch(int s)
{
    char *tty = NULL;
    int fd = 0;
    int result = 0;
    struct winsize win;

    tty = ttyname(0);
    if (!tty)
	return;
    fd = open(tty, O_RDWR);
    if (fd == -1)
	return;
    result = ioctl(fd, TIOCGWINSZ, &win);
    if (result == -1)
	return;

    COLS = win.ws_col;
    LINES = win.ws_row;

#ifdef HAVE_RESIZETERM
    resizeterm(LINES, COLS);
#ifdef HAVE_WRESIZE
    if (wresize(stdscr, LINES, COLS) == ERR)
	c_die("Cannot resize window!");
#endif				/* HAVE_WRESIZE */
#endif				/* HAVE_RESIZETERM */

    var_init();
    /* Do these b/c width may have changed... */
    clear();
    refresh();

}