From fc00c656c96528112d05cf0edf8631bd5eaea446 Mon Sep 17 00:00:00 2001 From: Kacper Date: Sun, 7 Dec 2025 20:10:31 +0100 Subject: Add build system scaffolding and libc headers --- lib/libc/stdio/setvbuf.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 lib/libc/stdio/setvbuf.c (limited to 'lib/libc/stdio/setvbuf.c') diff --git a/lib/libc/stdio/setvbuf.c b/lib/libc/stdio/setvbuf.c new file mode 100644 index 00000000..56d7196c --- /dev/null +++ b/lib/libc/stdio/setvbuf.c @@ -0,0 +1,20 @@ +#include +#include + +int setvbuf(FILE *restrict stream, char *restrict buf, int type, size_t size) +{ + if (type != _IOFBF && type != _IOLBF && type != _IONBF) + return -1; + if (type != _IONBF && (buf == NULL || size == 0)) + return -1; + + if (stream->fd < 0) + return -1; + + stream->buf = buf; + stream->buf_size = size; + stream->buf_pos = 0; + stream->type = type; + + return 0; +} -- cgit v1.2.3