diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/api/libc/stdio.h | 18 | ||||
| -rw-r--r-- | lib/api/libc/string.h | 14 | ||||
| -rw-r--r-- | lib/libc/memcmp.c (renamed from lib/memcmp.c) | 0 | ||||
| -rw-r--r-- | lib/libc/memcpy.c (renamed from lib/memcpy.c) | 0 | ||||
| -rw-r--r-- | lib/libc/memmove.c (renamed from lib/memmove.c) | 0 | ||||
| -rw-r--r-- | lib/libc/memset.c (renamed from lib/memset.c) | 0 | ||||
| -rw-r--r-- | lib/libc/printf.c (renamed from lib/kprintf.c) | 20 | ||||
| -rw-r--r-- | lib/libc/string.c (renamed from lib/string.c) | 2 |
8 files changed, 43 insertions, 11 deletions
diff --git a/lib/api/libc/stdio.h b/lib/api/libc/stdio.h new file mode 100644 index 0000000..1edec4a --- /dev/null +++ b/lib/api/libc/stdio.h @@ -0,0 +1,18 @@ +#pragma once + +#include <libc/string.h> + +#include <stdarg.h> + +typedef struct FILE FILE; + +extern FILE *stdout; +extern FILE *stderr; + +extern int fputc(int c, FILE *f); + +int vfprintf(FILE *f, const char *restrict format, va_list arguments); +int fprintf(FILE *f, const char *restrict format, ...); +int vprintf(const char *restrict format, va_list arguments); +int printf(const char *restrict format, ...); + diff --git a/lib/api/libc/string.h b/lib/api/libc/string.h new file mode 100644 index 0000000..c28e17c --- /dev/null +++ b/lib/api/libc/string.h @@ -0,0 +1,14 @@ +#pragma once + +#include <stddef.h> + +void *memcpy(void *dest, const void *src, size_t size); +void *memmove(void *dest, const void *src, size_t size); +void *memset(void *dest, int val, size_t size); +int memcmp(const void *str1, const void *str2, size_t count); +size_t strlen(const char *s); +unsigned long long strtoull( + const char *restrict begin, + char **restrict end, + int base); + diff --git a/lib/memcmp.c b/lib/libc/memcmp.c index 2348afe..2348afe 100644 --- a/lib/memcmp.c +++ b/lib/libc/memcmp.c diff --git a/lib/memcpy.c b/lib/libc/memcpy.c index 58b1e40..58b1e40 100644 --- a/lib/memcpy.c +++ b/lib/libc/memcpy.c diff --git a/lib/memmove.c b/lib/libc/memmove.c index fd06bb6..fd06bb6 100644 --- a/lib/memmove.c +++ b/lib/libc/memmove.c diff --git a/lib/memset.c b/lib/libc/memset.c index 3e7025e..3e7025e 100644 --- a/lib/memset.c +++ b/lib/libc/memset.c diff --git a/lib/kprintf.c b/lib/libc/printf.c index 3d803f6..ad33cca 100644 --- a/lib/kprintf.c +++ b/lib/libc/printf.c @@ -1,4 +1,4 @@ -#include <lib/kstdio.h> +#include <libc/stdio.h> #include <stddef.h> #include <stdint.h> #include <stdbool.h> @@ -561,14 +561,14 @@ static int printf_internal( static int kfp_write_character(struct method *m, char c) { - kfputc((int)c, (FILE *)m->output); + fputc((int)c, (FILE *)m->output); m->count++; return 0; } static int kfp_write_wcharacter(struct method *m, wchar_t c) { - kfputc((int)c, (FILE *)m->output); + fputc((int)c, (FILE *)m->output); m->count++; return 0; } @@ -591,7 +591,7 @@ static int kfp_write_wstring(struct method *m, const wchar_t *s) return 0; } -int kvfprintf(FILE *f, const char *restrict format, va_list arguments) +int vfprintf(FILE *f, const char *restrict format, va_list arguments) { struct method m = { kfp_write_character, @@ -615,36 +615,36 @@ int kvfprintf(FILE *f, const char *restrict format, va_list arguments) } } -int kfprintf(FILE *f, const char *restrict format, ...) +int fprintf(FILE *f, const char *restrict format, ...) { va_list arguments; va_start(arguments, format); - int count = kvfprintf(f, format, arguments); + int count = vfprintf(f, format, arguments); va_end(arguments); return count; } -int kvprintf(const char *restrict format, va_list arguments) +int vprintf(const char *restrict format, va_list arguments) { va_list acopy; va_copy(acopy, arguments); - int count = kvfprintf(kstdout, format, arguments); + int count = vfprintf(stdout, format, arguments); va_end(acopy); return count; } -int kprintf(const char *restrict format, ...) +int printf(const char *restrict format, ...) { va_list arguments; va_start(arguments, format); - int count = kvprintf(format, arguments); + int count = vprintf(format, arguments); va_end(arguments); diff --git a/lib/string.c b/lib/libc/string.c index f6bc682..9316d98 100644 --- a/lib/string.c +++ b/lib/libc/string.c @@ -1,4 +1,4 @@ -#include <lib/kstring.h> +#include <libc/string.h> #include <stdbool.h> size_t strlen(const char *s) |
