Author: uwe Date: 2008-04-02 14:35:45 +0200 (Wed, 02 Apr 2008) New Revision: 3210
Modified: trunk/payloads/libpayload/LICENSES trunk/payloads/libpayload/include/libpayload.h trunk/payloads/libpayload/libc/printf.c Log: Add missing snprintf() to libc/printf.c (trivial). This is also taken from the HelenOS project.
Signed-off-by: Uwe Hermann uwe@hermann-uwe.de Acked-by: Uwe Hermann uwe@hermann-uwe.de
Modified: trunk/payloads/libpayload/LICENSES =================================================================== --- trunk/payloads/libpayload/LICENSES 2008-04-01 17:14:57 UTC (rev 3209) +++ trunk/payloads/libpayload/LICENSES 2008-04-02 12:35:45 UTC (rev 3210) @@ -78,6 +78,7 @@ svn checkout svn://svn.helenos.eu/HelenOS/trunk HelenOS http://svn.helenos.eu/chora/browse.php?f=%2Ftrunk%2F Original files: kernel/generic/src/printf/printf_core.c + kernel/generic/src/printf/snprintf.c kernel/generic/src/printf/sprintf.c kernel/generic/src/printf/vsnprintf.c kernel/generic/src/printf/vsprintf.c
Modified: trunk/payloads/libpayload/include/libpayload.h =================================================================== --- trunk/payloads/libpayload/include/libpayload.h 2008-04-01 17:14:57 UTC (rev 3209) +++ trunk/payloads/libpayload/include/libpayload.h 2008-04-02 12:35:45 UTC (rev 3210) @@ -110,6 +110,7 @@ int memcmp(const char *s1, const char *s2, size_t len);
/* libc/printf.c */ +int snprintf(char *str, size_t size, const char *fmt, ...); int sprintf(char *str, const char *fmt, ...); int vsnprintf(char *str, size_t size, const char *fmt, va_list ap); int vsprintf(char *str, const char *fmt, va_list ap);
Modified: trunk/payloads/libpayload/libc/printf.c =================================================================== --- trunk/payloads/libpayload/libc/printf.c 2008-04-01 17:14:57 UTC (rev 3209) +++ trunk/payloads/libpayload/libc/printf.c 2008-04-02 12:35:45 UTC (rev 3210) @@ -694,6 +694,18 @@ return counter; }
+int snprintf(char *str, size_t size, const char *fmt, ...) +{ + int ret; + va_list args; + + va_start(args, fmt); + ret = vsnprintf(str, size, fmt, args); + va_end(args); + + return ret; +} + int sprintf(char *str, const char *fmt, ...) { int ret;