Add snprintf and remove our sprintf

This commit is contained in:
philip 2020-09-22 20:41:07 -04:00 committed by Marcel Stör
parent a6beec9f0f
commit 60f0150736
5 changed files with 2152 additions and 1074 deletions

View File

@ -22,7 +22,7 @@ endif
# makefile at its root level - these are then overridden
# for a subtree within the makefile rooted therein
#
#DEFINES +=
DEFINES += -DHAVE_CONFIG_H
#############################################################
# Recursion Magic - Don't touch this!!

39
app/libc/snp_config.h Normal file
View File

@ -0,0 +1,39 @@
#ifndef SNP_CONFIG_H
#define SNP_CONFIG_H
#define TEST_SNPRINTF 0
#define HAVE_SNPRINTF 0
#define HAVE_VSNPRINTF 0
#define HAVE_ASPRINTF 0
#define HAVE_VASPRINTF 0
#define HAVE_STDARG_H 1
#define HAVE_STDLIB_H 1
#define HAVE_VA_COPY 0
#define HAVE___VA_COPY 0
#define HAVE_FLOAT_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_LOCALE_H 0
#define HAVE_STDDEF_H 1
#define HAVE_STDINT_H 1
#define HAVE_UNSIGNED_LONG_LONG_INT 1
#define HAVE_UINTMAX_T 1
#define HAVE_LONG_DOUBLE 0
#define HAVE_LONG_LONG_INT 1
#define HAVE_INTMAX_T 1
#define HAVE_UINTPTR_T 1
#define HAVE_PTRDIFF_T 1
#define HAVE_LOCALECONV 0
#define HAVE_LCONV_DECIMAL_POINT 0
#define HAVE_LCONV_THOUSANDS_SEP 0
#define LDOUBLE_MIN_10_EXP DBL_MIN_10_EXP
#define LDOUBLE_MAX_10_EXP DBL_MAX_10_EXP
#define rpl_snprintf snprintf
#define rpl_vsnprintf vsnprintf
#define rpl_vasprintf vasprintf
#define rpl_asprintf asprintf
#endif /* SNP_CONFIG_H */

2110
app/libc/snprintf.c Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -14,8 +14,9 @@ extern void output_redirect(const char *str, size_t l);
#define printf(...) do { \
char __printf_buf[BUFSIZ]; \
sprintf(__printf_buf, __VA_ARGS__); \
snprintf(__printf_buf, BUFSIZ, __VA_ARGS__); \
puts(__printf_buf); \
} while(0)
#endif