aboutsummaryrefslogtreecommitdiff
path: root/lib/tctl
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2023-01-17 22:49:31 +0100
committerNathan Reiner <nathan@nathanreiner.xyz>2023-01-17 22:49:31 +0100
commit1a66f5d069e4ccb600186918f716323aa7bae052 (patch)
tree9010251014a766f29d1c2fb6c30c9abdb1766962 /lib/tctl
parentb2146cd4d6e6f5fda36d59c054e0634a2098a03c (diff)
add tctl and list
Diffstat (limited to 'lib/tctl')
-rw-r--r--lib/tctl/tctl.c18
-rw-r--r--lib/tctl/tctl.h14
2 files changed, 32 insertions, 0 deletions
diff --git a/lib/tctl/tctl.c b/lib/tctl/tctl.c
new file mode 100644
index 0000000..54034f4
--- /dev/null
+++ b/lib/tctl/tctl.c
@@ -0,0 +1,18 @@
+#include "tctl.h"
+#include "../sys/ioctl.h"
+
+#define GET_WIN_SIZE 0x5413
+#define SET_WIN_SIZE 0x5414
+
+window_size_t tctl_get_window_size()
+{
+ window_size_t ws;
+ ioctl(0, GET_WIN_SIZE, &ws);
+ return ws;
+}
+
+
+void tctl_set_window_size(window_size_t size)
+{
+ ioctl(0, SET_WIN_SIZE, &size);
+}
diff --git a/lib/tctl/tctl.h b/lib/tctl/tctl.h
new file mode 100644
index 0000000..d106818
--- /dev/null
+++ b/lib/tctl/tctl.h
@@ -0,0 +1,14 @@
+#ifndef TCTL_H
+#define TCTL_H
+
+typedef struct {
+ unsigned short int height;
+ unsigned short int width;
+ unsigned short int ws_xpixel;
+ unsigned short int ws_ypixel;
+} window_size_t;
+
+window_size_t tctl_get_window_size();
+void tctl_set_window_size(window_size_t size);
+
+#endif