summaryrefslogtreecommitdiff
path: root/src/stdio/__stdout_write.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stdio/__stdout_write.c')
-rw-r--r--src/stdio/__stdout_write.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/stdio/__stdout_write.c b/src/stdio/__stdout_write.c
new file mode 100644
index 0000000..dd1ec60
--- /dev/null
+++ b/src/stdio/__stdout_write.c
@@ -0,0 +1,11 @@
+#include "stdio_impl.h"
+#include <sys/ioctl.h>
+
+size_t __stdout_write(FILE *f, const unsigned char *buf, size_t len)
+{
+ struct winsize wsz;
+ f->write = __stdio_write;
+ if (!(f->flags & F_SVB) && __syscall(SYS_ioctl, f->fd, TIOCGWINSZ, &wsz))
+ f->lbf = -1;
+ return __stdio_write(f, buf, len);
+}