diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2025-04-15 10:36:12 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2025-04-15 10:36:12 -0400 |
commit | 99ee1a95551cd869c56f5ee0a07047a35e8900d6 (patch) | |
tree | 8a01538c5f7f14910d479d47f96c55ae682db46f /src/bfstd.h | |
parent | a81e98b3db4948cba6a597387f96d10c08e4d75c (diff) | |
download | bfs-99ee1a95551cd869c56f5ee0a07047a35e8900d6.tar.xz |
bfstd: Add a tcgetwinsize() polyfill
Diffstat (limited to 'src/bfstd.h')
-rw-r--r-- | src/bfstd.h | 28 |
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> /** |