aboutsummaryrefslogtreecommitdiff
path: root/lib/tctl
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2023-02-09 09:31:24 +0100
committerNathan Reiner <nathan@nathanreiner.xyz>2023-02-09 09:31:24 +0100
commit3ab649953a8782b3bb82019f021739b898239c6f (patch)
tree3e0776b70f232005dba19c904992112d9bda44a9 /lib/tctl
parentf298e9e8d66582293fab2a2845ed2808924c1cd4 (diff)
make mdv center
Diffstat (limited to 'lib/tctl')
-rw-r--r--lib/tctl/tctl.c16
-rw-r--r--lib/tctl/tctl.h2
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);