aboutsummaryrefslogtreecommitdiff
path: root/lib/tctl/tctl.c
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2023-02-08 17:12:23 +0100
committerNathan Reiner <nathan@nathanreiner.xyz>2023-02-08 17:12:23 +0100
commitb97ec93748902c90f25524116d3d189f1b263474 (patch)
treec1ef2d49937c0e5df28fefe4e88222783adaf3cf /lib/tctl/tctl.c
parent262322f9742ee925fe135038a9bbb631acd56b36 (diff)
make ls cooler
Diffstat (limited to 'lib/tctl/tctl.c')
-rw-r--r--lib/tctl/tctl.c12
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;
}