master
1#include "stdio_impl.h"
2#include <sys/ioctl.h>
3#ifdef __wasilibc_unmodified_upstream // use isatty rather than manual ioctl
4#else
5#include <__function___isatty.h>
6#endif
7
8size_t __stdout_write(FILE *f, const unsigned char *buf, size_t len)
9{
10#ifdef __wasilibc_unmodified_upstream // use isatty rather than manual ioctl
11 struct winsize wsz;
12#endif
13 f->write = __stdio_write;
14#ifdef __wasilibc_unmodified_upstream // use isatty rather than manual ioctl
15 if (!(f->flags & F_SVB) && __syscall(SYS_ioctl, f->fd, TIOCGWINSZ, &wsz))
16#else
17 if (!(f->flags & F_SVB) && !__isatty(f->fd))
18#endif
19 f->lbf = -1;
20 return __stdio_write(f, buf, len);
21}