From 41ee6b43c89ce67808a684ba67f69e964b0636fa Mon Sep 17 00:00:00 2001 From: aqua Date: Sat, 18 Feb 2023 10:12:24 +0200 Subject: Move C stdlib to lib/libk --- lib/stdio/vfprintf.cpp | 54 -------------------------------------------------- 1 file changed, 54 deletions(-) delete mode 100644 lib/stdio/vfprintf.cpp (limited to 'lib/stdio/vfprintf.cpp') diff --git a/lib/stdio/vfprintf.cpp b/lib/stdio/vfprintf.cpp deleted file mode 100644 index aa9256d..0000000 --- a/lib/stdio/vfprintf.cpp +++ /dev/null @@ -1,54 +0,0 @@ -#include -#include - -static char buffer[3 * sizeof(int) + 2]; - -extern "C" int -vfprintf(FILE *restrict stream, const char *restrict format, va_list params) -{ - int written = 0; - - int s = 0; - int l = 0; - for (int i = 0; format[i] != '\0'; ++i) { - if (format[i] == '%') { - written += stream->puts(&format[s], l); - s = i + 2; - ++i; - - switch (format[i]) { - case 's': { - const char *arg = va_arg(params, const char *); - written += stream->puts(arg, -1); - } break; - case 'c': { - const int arg = va_arg(params, int); - stream->putc(arg); - ++written; - } break; - case 'd': { - const char *arg = itoa(buffer, va_arg(params, int), 10); - written += stream->puts(arg, -1); - } break; - case 'u': { - const char *arg = utoa(buffer, va_arg(params, unsigned int), 10); - written += stream->puts(arg, -1); - } break; - case 'x': { - const char *arg = utoa(buffer, va_arg(params, unsigned int), 16); - written += stream->puts(arg, -1); - } break; - } - - l = 0; - } - - else - ++l; - } - - if (l > 0) { written += stream->puts(&format[s], l); } - - stream->flush(); - return written; -} -- cgit v1.2.1