diff options
| author | Nathan Reiner <nathan@nathanreiner.xyz> | 2023-02-09 09:31:24 +0100 |
|---|---|---|
| committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2023-02-09 09:31:24 +0100 |
| commit | 3ab649953a8782b3bb82019f021739b898239c6f (patch) | |
| tree | 3e0776b70f232005dba19c904992112d9bda44a9 /lib | |
| parent | f298e9e8d66582293fab2a2845ed2808924c1cd4 (diff) | |
make mdv center
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/tctl/tctl.c | 16 | ||||
| -rw-r--r-- | lib/tctl/tctl.h | 2 |
2 files changed, 18 insertions, 0 deletions
diff --git a/lib/tctl/tctl.c b/lib/tctl/tctl.c index d54f2dd..3bdc2fd 100644 --- a/lib/tctl/tctl.c +++ b/lib/tctl/tctl.c @@ -9,6 +9,22 @@ #define ICANON 000002 #define ECHO 000010 + +window_size_t tctl_get_fd_window_size(int fd) +{ + window_size_t ws; + ioctl(fd, GET_WIN_SIZE, &ws); + return ws; +} + + +void tctl_set_fd_window_size(int fd, window_size_t size) +{ + ioctl(fd, SET_WIN_SIZE, &size); +} + + + window_size_t tctl_get_window_size() { window_size_t ws; diff --git a/lib/tctl/tctl.h b/lib/tctl/tctl.h index d16c9eb..a650626 100644 --- a/lib/tctl/tctl.h +++ b/lib/tctl/tctl.h @@ -19,6 +19,8 @@ typedef struct { window_size_t tctl_get_window_size(); void tctl_set_window_size(window_size_t size); +window_size_t tctl_get_fd_window_size(int fd); +void tctl_set_fd_window_size(int fd, window_size_t size); int isatty(); int tcgetattr(int fd, termios_t *termios); void tcsetattr(int fd, termios_t *termios); |