refactor: separate syscall interfaces from kernel space, into posix compliant structure.
[lunaix-os.git] / lunaix-os / libs / ulibc / printf.c
1 #include <klibc/stdio.h>
2 #include <lunaix/spike.h>
3 #include <ulibc/stdio.h>
4
5 #include <usr/unistd.h>
6
7 // This is VERY bad implementation as it mixes both kernel and user space
8 // code together. It is here however, just for the convenience of our testing
9 // program.
10 // FIXME Eliminate this when we're able to load program.
11
12 void __USER__
13 printf(const char* fmt, ...)
14 {
15     const char buf[512];
16     va_list args;
17     va_start(args, fmt);
18
19     size_t sz = __ksprintf_internal(buf, fmt, 512, args);
20
21     write(stdout, buf, sz);
22
23     va_end(args);
24 }