diff options
Diffstat (limited to 'lib/tctl/tctl.c')
| -rw-r--r-- | lib/tctl/tctl.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/tctl/tctl.c b/lib/tctl/tctl.c index 54034f4..187d1a9 100644 --- a/lib/tctl/tctl.c +++ b/lib/tctl/tctl.c @@ -3,16 +3,24 @@ #define GET_WIN_SIZE 0x5413 #define SET_WIN_SIZE 0x5414 +#define TC_GET_ATTR 0x5401 window_size_t tctl_get_window_size() { window_size_t ws; - ioctl(0, GET_WIN_SIZE, &ws); + ioctl(1, GET_WIN_SIZE, &ws); return ws; } void tctl_set_window_size(window_size_t size) { - ioctl(0, SET_WIN_SIZE, &size); + ioctl(1, SET_WIN_SIZE, &size); +} + + +int isatty() +{ + termios_t term; + return ioctl(1, TC_GET_ATTR, &term) == 0; } |