diff options
| author | Ada Christine <adachristine18@gmail.com> | 2026-05-26 21:32:27 +0000 |
|---|---|---|
| committer | Ada Christine <adachristine18@gmail.com> | 2026-05-26 21:32:27 +0000 |
| commit | a10aabfcd52f702057316018cd7847ab2bfe4aa1 (patch) | |
| tree | cc4652d2b602798934e8a48b4939cfb20eda1989 /lib/libc/stdio.c | |
| parent | 90c29fdde317c39384011a6ba97077c138f13ad6 (diff) | |
we're bringing kjarna back and not doing the crazy stuff with trying to have task management during efi. that was a bit extra.kjarna
Diffstat (limited to 'lib/libc/stdio.c')
| -rw-r--r-- | lib/libc/stdio.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/libc/stdio.c b/lib/libc/stdio.c new file mode 100644 index 0000000..70cc685 --- /dev/null +++ b/lib/libc/stdio.c @@ -0,0 +1,30 @@ +#include <libc/stdio.h> +#include <libc/string.h> +#include <posix/unistd.h> + +struct FILE +{ + int fd; +}; + +static FILE stdin_stream = { STDIN_FILENO }; +static FILE stdout_stream = { STDOUT_FILENO }; +static FILE stderr_stream = { STDERR_FILENO }; + +FILE *stdin = &stdin_stream; +FILE *stdout = &stdout_stream; +FILE *stderr = &stderr_stream; + +int fputc(int c, FILE *f) +{ + write(f->fd, (const char *)&c, 1); + return 1; +} + +int fputs(const char *s, FILE *f) +{ + size_t slen = strlen(s); + write(f->fd, s, slen); + return (int)slen; +} + |
