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