From a15ab24d9b380e12953aa69ac6c581faaf5df8b8 Mon Sep 17 00:00:00 2001 From: Drew Galbraith Date: Mon, 19 Jun 2023 21:46:02 -0700 Subject: [PATCH] [libc] Add %s to sprintf --- lib/libc/src/stdio.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/libc/src/stdio.cpp b/lib/libc/src/stdio.cpp index b6b2176..7e83748 100644 --- a/lib/libc/src/stdio.cpp +++ b/lib/libc/src/stdio.cpp @@ -104,6 +104,15 @@ int vsprintf(char *str, const char *format, va_list arg) { format++; break; } + case 's': { + char *instr = va_arg(arg, char *); + int width = 0; + while (*instr != '\0') { + *(str++) = *(instr++); + width++; + } + break; + } default: *(str++) = *(format++); chars++;