X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/5ea8e2ba737f903db81d49b56778e883634512a5..e5c3c8accffbcd77fea12ccf2b0accc70c645aaa:/lunaix-os/libs/ulibc/printf.c?ds=inline diff --git a/lunaix-os/libs/ulibc/printf.c b/lunaix-os/libs/ulibc/printf.c new file mode 100644 index 0000000..18e2387 --- /dev/null +++ b/lunaix-os/libs/ulibc/printf.c @@ -0,0 +1,23 @@ +#include +#include +#include +#include + +// This is VERY bad implementation as it mixes both kernel and user space +// code together. It is here however, just for the convenience of our testing +// program. +// FIXME Eliminate this when we're able to load program. + +void __USER__ +printf(const char* fmt, ...) +{ + const char buf[512]; + va_list args; + va_start(args, fmt); + + size_t sz = __ksprintf_internal(buf, fmt, 512, args); + + write(stdout, buf, sz); + + va_end(args); +} \ No newline at end of file