diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 13:54:38 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 13:54:38 +0000 |
commit | 8c1ab65c0f548d20b7f177bdb736daaf603340e1 (patch) | |
tree | df55b7e75bf43f2bf500845b105afe3ac3a5157e /libc-top-half/musl/src/stdio/__stdout_write.c | |
parent | Initial commit. (diff) | |
download | wasi-libc-8c1ab65c0f548d20b7f177bdb736daaf603340e1.tar.xz wasi-libc-8c1ab65c0f548d20b7f177bdb736daaf603340e1.zip |
Adding upstream version 0.0~git20221206.8b7148f.upstream/0.0_git20221206.8b7148f
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'libc-top-half/musl/src/stdio/__stdout_write.c')
-rw-r--r-- | libc-top-half/musl/src/stdio/__stdout_write.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/libc-top-half/musl/src/stdio/__stdout_write.c b/libc-top-half/musl/src/stdio/__stdout_write.c new file mode 100644 index 0000000..8190ec5 --- /dev/null +++ b/libc-top-half/musl/src/stdio/__stdout_write.c @@ -0,0 +1,21 @@ +#include "stdio_impl.h" +#include <sys/ioctl.h> +#ifdef __wasilibc_unmodified_upstream // use isatty rather than manual ioctl +#else +#include <__function___isatty.h> +#endif + +size_t __stdout_write(FILE *f, const unsigned char *buf, size_t len) +{ +#ifdef __wasilibc_unmodified_upstream // use isatty rather than manual ioctl + struct winsize wsz; +#endif + f->write = __stdio_write; +#ifdef __wasilibc_unmodified_upstream // use isatty rather than manual ioctl + if (!(f->flags & F_SVB) && __syscall(SYS_ioctl, f->fd, TIOCGWINSZ, &wsz)) +#else + if (!(f->flags & F_SVB) && !__isatty(f->fd)) +#endif + f->lbf = -1; + return __stdio_write(f, buf, len); +} |