summaryrefslogtreecommitdiff
path: root/src/libc/printf.c
diff options
context:
space:
mode:
authordzwdz2023-09-03 01:30:53 +0200
committerdzwdz2023-09-03 01:30:53 +0200
commita492c6ec119bd1151a6f2f7b70875ba173e9c036 (patch)
treea96f9d4ff4b120ecd58f8f41ab26b5a28fd368c0 /src/libc/printf.c
parentfd80c0b227336f4650d6b54d82469feb017aeded (diff)
libc: split up large .c files, slimming down small binaries a bit
Diffstat (limited to 'src/libc/printf.c')
-rw-r--r--src/libc/printf.c60
1 files changed, 0 insertions, 60 deletions
diff --git a/src/libc/printf.c b/src/libc/printf.c
deleted file mode 100644
index a760240..0000000
--- a/src/libc/printf.c
+++ /dev/null
@@ -1,60 +0,0 @@
-#include <camellia/syscalls.h>
-#include <shared/printf.h>
-#include <stdio.h>
-#include <string.h>
-
-
-static void backend_file(void *arg, const char *buf, size_t len) {
- fwrite(buf, 1, len, arg);
-}
-
-int vfprintf(FILE *restrict f, const char *restrict fmt, va_list ap) {
- return __printf_internal(fmt, ap, backend_file, f);
-}
-
-
-int printf(const char *restrict fmt, ...) {
- int ret;
- va_list argp;
- va_start(argp, fmt);
- ret = vprintf(fmt, argp);
- va_end(argp);
- return ret;
-}
-
-int fprintf(FILE *restrict f, const char *restrict fmt, ...) {
- int ret;
- va_list argp;
- va_start(argp, fmt);
- ret = vfprintf(f, fmt, argp);
- va_end(argp);
- return ret;
-}
-
-int sprintf(char *restrict s, const char *restrict fmt, ...) {
- int ret;
- va_list argp;
- va_start(argp, fmt);
- ret = vsnprintf(s, ~0, fmt, argp);
- va_end(argp);
- return ret;
-}
-
-int vprintf(const char *restrict fmt, va_list ap) {
- return vfprintf(stdout, fmt, ap);
-}
-
-int vsprintf(char *restrict s, const char *restrict fmt, va_list ap) {
- return vsnprintf(s, ~0, fmt, ap);
-}
-
-int _klogf(const char *fmt, ...) {
- char buf[256];
- int ret;
- va_list argp;
- va_start(argp, fmt);
- ret = vsnprintf(buf, sizeof buf, fmt, argp);
- va_end(argp);
- _sys_debug_klog(buf, ret);
- return ret;
-}