summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJeff Andersen <jeffandersen@google.com>2018-03-20 12:05:49 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2018-03-27 18:22:22 +0000
commit97871a1ca883ee8116f0e56968a070d8db42c98d (patch)
tree8cc2b3f9f45dd3260c0bb81f9e6317f865cafa70 /include
parentbee6d1a877d2fb89379f778fd71505186f53a1a0 (diff)
downloadchrome-ec-97871a1ca883ee8116f0e56968a070d8db42c98d.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=none 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> Reviewed-on: https://chromium-review.googlesource.com/982313 Reviewed-by: Furquan Shaikh <furquan@chromium.org> Commit-Queue: Furquan Shaikh <furquan@chromium.org> Tested-by: Furquan Shaikh <furquan@chromium.org> Trybot-Ready: Furquan Shaikh <furquan@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/printf.h13
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 */