diff options
author | aqua <aqua@iserlohn-fortress.net> | 2023-10-08 19:50:00 +0300 |
---|---|---|
committer | aqua <aqua@iserlohn-fortress.net> | 2023-11-27 21:02:22 +0200 |
commit | fc13fb2ba5993d06d9d6ae5e80bc337aebbdc119 (patch) | |
tree | 9607ab4d5f1d4069d4f761a0b25eada36088bd6b /lib/libk/include/stdio.h | |
parent | rules.mk: make include paths absolute (diff) | |
download | kernel-fc13fb2ba5993d06d9d6ae5e80bc337aebbdc119.tar.xz |
Use meson build system
Diffstat (limited to 'lib/libk/include/stdio.h')
-rw-r--r-- | lib/libk/include/stdio.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/lib/libk/include/stdio.h b/lib/libk/include/stdio.h new file mode 100644 index 0000000..7a6e663 --- /dev/null +++ b/lib/libk/include/stdio.h @@ -0,0 +1,41 @@ +#pragma once + +#include <stdarg.h> + +/** An object type used for streams */ +typedef struct FILE { + int id; + + /** Function that prints a character to the stream */ + void (*putc)(const struct FILE *, char); + + /** Function that prints a string to the stream */ + int (*puts)(const struct FILE *, const char *, int); + + /** Flush write buffers */ + void (*flush)(const struct FILE *); +} FILE; + +/** A FILE value corresponding to stdin, the keyboard buffer */ +extern FILE *stdin; +/** A FILE value corresponding to stdout, the display */ +extern FILE *stdout; +/** A FILE value corresponding to stderr, the uart */ +extern FILE *stderr; + +/** + * Write the formatted string to stdout + * Supports ``%s`` (string), ``%d`` (decimal), ``%u`` (unsigned), ``%x`` (hexadecimal) + * @return number of bytes written + */ +int printf(const char *__restrict__ format, ...); + +/** + * Write the formatted string to stream; see printf + */ +int fprintf(FILE *__restrict__ stream, const char *__restrict__ format, ...); + +/** + * Write the formatted string to stream; see printf + */ +int vfprintf(FILE *__restrict__ stream, const char *__restrict__ format, va_list ap); |