summaryrefslogtreecommitdiffstats
path: root/src/bfstd.h
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2025-04-15 10:36:12 -0400
committerTavian Barnes <tavianator@tavianator.com>2025-04-15 10:36:12 -0400
commit99ee1a95551cd869c56f5ee0a07047a35e8900d6 (patch)
tree8a01538c5f7f14910d479d47f96c55ae682db46f /src/bfstd.h
parenta81e98b3db4948cba6a597387f96d10c08e4d75c (diff)
downloadbfs-99ee1a95551cd869c56f5ee0a07047a35e8900d6.tar.xz
bfstd: Add a tcgetwinsize() polyfill
Diffstat (limited to 'src/bfstd.h')
-rw-r--r--src/bfstd.h28
1 files changed, 18 insertions, 10 deletions
diff --git a/src/bfstd.h b/src/bfstd.h
index 28f473e..a17ce95 100644
--- a/src/bfstd.h
+++ b/src/bfstd.h
@@ -158,16 +158,6 @@ FILE *xfopen(const char *path, int flags);
*/
char *xgetdelim(FILE *file, char delim);
-/**
- * Open the controlling terminal.
- *
- * @flags
- * The open() flags.
- * @return
- * An open file descriptor, or -1 on failure.
- */
-int open_cterm(int flags);
-
// #include <stdlib.h>
/**
@@ -342,6 +332,24 @@ int xminor(dev_t dev);
*/
pid_t xwaitpid(pid_t pid, int *status, int flags);
+#include <sys/ioctl.h> // May be necessary for struct winsize
+#include <termios.h>
+
+/**
+ * Open the controlling terminal.
+ *
+ * @flags
+ * The open() flags.
+ * @return
+ * An open file descriptor, or -1 on failure.
+ */
+int open_cterm(int flags);
+
+/**
+ * tcgetwinsize()/ioctl(TIOCGWINSZ) wrapper.
+ */
+int xtcgetwinsize(int fd, struct winsize *ws);
+
// #include <unistd.h>
/**