-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathathr_terminal.c
36 lines (28 loc) · 949 Bytes
/
athr_terminal.c
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
35
36
#include "athr_terminal.h"
#if defined(ATHR_TERMINAL_CURSES)
#include "athr_terminal_curses.h"
#endif
#if defined(ATHR_TERMINAL_WIN32)
#include "athr_terminal_win32.h"
#endif
#if defined(ATHR_TERMINAL_IOCTL)
#include "athr_terminal_ioctl.h"
#endif
static unsigned fallback_width = 80;
static bool force_fallback_use = false;
void athr_terminal_set_fallback_width(unsigned width) { fallback_width = width; }
void athr_terminal_force_fallback_use(bool v) { force_fallback_use = v; }
unsigned athr_terminal_width(void)
{
if (force_fallback_use) return athr_terminal_fallback_width();
#if defined(ATHR_TERMINAL_CURSES)
return athr_terminal_curses_width();
#elif defined(ATHR_TERMINAL_WIN32)
return athr_terminal_win32_width();
#elif defined(ATHR_TERMINAL_IOCTL)
return athr_terminal_ioctl_width();
#else
return __athr_terminal_fallback_width();
#endif
}
unsigned athr_terminal_fallback_width(void) { return fallback_width; }