diff options
Diffstat (limited to 'kernel/libc')
-rw-r--r-- | kernel/libc/include/stdio.h | 3 | ||||
-rw-r--r-- | kernel/libc/stdio/print.c | 20 |
2 files changed, 12 insertions, 11 deletions
diff --git a/kernel/libc/include/stdio.h b/kernel/libc/include/stdio.h index f2bbb32..9dd496e 100644 --- a/kernel/libc/include/stdio.h +++ b/kernel/libc/include/stdio.h @@ -1,9 +1,10 @@ #ifndef STDIO_H #define STDIO_H +#include <stdarg.h> void putc(const char c); -int puts(char *str); void delete_characther(void); int kprintf(const char *format, ...); +int vkprintf(const char *format, va_list list); #endif diff --git a/kernel/libc/stdio/print.c b/kernel/libc/stdio/print.c index 93393ee..e8b245f 100644 --- a/kernel/libc/stdio/print.c +++ b/kernel/libc/stdio/print.c @@ -1,7 +1,6 @@ -#include "../../drivers/serial.h" -#include "../include/assert.h" -#include "../include/stdio.h" -#include <stdarg.h> +#include <assert.h> +#include <drivers/serial.h> +#include <stdio.h> #define TAB_SIZE 8 @@ -55,11 +54,8 @@ int kprint_int(int num) { return c; } -int kprintf(const char *format, ...) { +int vkprintf(const char *format, va_list list) { int c = 0; - va_list list; - va_start(list, format); - const char *s = format; for (; *s; s++) { if ('%' != *s) { @@ -101,6 +97,10 @@ int kprintf(const char *format, ...) { return c; } -int puts(char *str) { - return kprintf("%s\n", str); +int kprintf(const char *format, ...) { + va_list list; + va_start(list, format); + int rc = vkprintf(format, list); + va_end(list); + return rc; } |