diff options
author | Jeff Andersen <jeffandersen@google.com> | 2018-03-20 12:05:49 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-03-20 19:30:06 -0700 |
commit | 228430afdd463c77a016e24370f64178e3102166 (patch) | |
tree | 9af1a94944eaa0e8f01048686df4266ac2d9d6e4 /include | |
parent | 50da99d5d4587ac5f11bc820e42d396d73a93f6c (diff) | |
download | chrome-ec-228430afdd463c77a016e24370f64178e3102166.tar.gz |
Add vsnprintf function.
This function enables variadic functions to take advantage
of functionality provided by snprintf.
Signed-off-by: Jeff Andersen <jeffandersen@google.com>
BRANCH=none
BUG=b:72360575
TEST=make buildall -j
Change-Id: I0095a96339b374ef8030b87b5184fa4678b439eb
Reviewed-on: https://chromium-review.googlesource.com/971761
Commit-Ready: Jeff Andersen <jeffandersen@google.com>
Tested-by: Jeff Andersen <jeffandersen@google.com>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/printf.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/printf.h b/include/printf.h index 96913bb601..441a7968f3 100644 --- a/include/printf.h +++ b/include/printf.h @@ -83,4 +83,17 @@ int vfnprintf(int (*addchar)(void *context, int c), void *context, */ int snprintf(char *str, int size, const char *format, ...); +/** + * Print formatted outut to a string. + * + * Guarantees null-termination if size!=0. + * + * @param str Destination string + * @param size Size of destination in bytes + * @param format Format string + * @param args Parameters + * @return EC_SUCCESS, or non-zero if output was truncated. + */ +int vsnprintf(char *str, int size, const char *format, va_list args); + #endif /* __CROS_EC_PRINTF_H */ |