aboutsummaryrefslogtreecommitdiff
path: root/core/tctl.c
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 /core/tctl.c
parentb2146cd4d6e6f5fda36d59c054e0634a2098a03c (diff)
add tctl and list
Diffstat (limited to 'core/tctl.c')
-rw-r--r--core/tctl.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/core/tctl.c b/core/tctl.c
new file mode 100644
index 0000000..e57c7cd
--- /dev/null
+++ b/core/tctl.c
@@ -0,0 +1,44 @@
+#include "../lib/io/io.h"
+#include "../lib/tctl/tctl.h"
+#include "../lib/arg/arg.h"
+#include "../lib/cstr/cstr.h"
+
+window_size_t size;
+
+void set_height(const char *h)
+{
+ size.height = cstr_to_u64(h);
+}
+
+
+void set_width(const char *h)
+{
+ size.width = cstr_to_u64(h);
+}
+
+
+int main(int argc, const char **argv)
+{
+ size.width = 0;
+ size.height = 0;
+
+ arg_register_arg("-w", &set_width);
+ arg_register_arg("-h", &set_height);
+ arg_parse_arg(argc, argv);
+
+ if (size.width == 0 && size.height == 0) {
+ size = tctl_get_window_size();
+ wstdf("width: %u, height: %u\n", size.width, size.height);
+ } else {
+ window_size_t new_size = tctl_get_window_size();
+
+ if (size.width != 0)
+ new_size.width = size.width;
+ if (size.height != 0)
+ new_size.height = size.height;
+
+ tctl_set_window_size(new_size);
+ }
+
+ return 0;
+}