ee507d4566/src/frobtadsappcurses.cc

ed1ed0d2610fa263bdfa644d4925520ecd25fd88ee507d456615ceaa597d645a5f587a88c567092a
3
#include "common.h"
3
#include "common.h"
4
4
5
#include <string.h>
5
#include <string.h>
6
#include <stdlib.h>
6
#if HAVE_TIOCGWINSZ || HAVE_TIOCGSIZE
7
#if HAVE_TIOCGWINSZ || HAVE_TIOCGSIZE
7
# if (!defined(GWINSZ_IN_SYS_IOCTL) || HAVE_TIOCGSIZE) && HAVE_TERMIOS_H
8
# if (!defined(GWINSZ_IN_SYS_IOCTL) || HAVE_TIOCGSIZE) && HAVE_TERMIOS_H
8
#  include <termios.h>
9
#  include <termios.h>
...
...
42
	w = size.ts_cols;
43
	w = size.ts_cols;
43
	h = size.ts_lines;
44
	h = size.ts_lines;
44
#endif
45
#endif
45
	if (res < 0 or w == 0 or h == 0) {
46
	if (res < 0) {
46
		// The call failed or the system doesn't seem to know
47
		// The call failed.
47
		// the terminal's size.
48
		return false;
48
		return false;
49
	}
49
	}
50
	if (w == 0 or h == 0) {
51
		// Kernel doesn't seem to know the terminal's size.		
52
		// Assume 80x24.
53
		width = 80;
54
		height = 24;
55
		return true;
56
	}
50
	width = w;
57
	width = w;
51
	height = h;
58
	height = h;
52
	return true;
59
	return true;