summaryrefslogtreecommitdiff
path: root/include/printf.h
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2012-10-25 12:46:08 -0700
committerGerrit <chrome-bot@google.com>2012-10-25 14:12:10 -0700
commite228692eb2b3828ee39adf5a668e71208478226a (patch)
tree18b2febd911da8de8a6d7515701fdd3a42494b7c /include/printf.h
parentf3d1fe08555de0157a27472ef68d1230bf60115b (diff)
downloadchrome-ec-e228692eb2b3828ee39adf5a668e71208478226a.tar.gz
Clean up printf module
No functional changes. BUG=chrome-os-partner:15579 BRANCH=none TEST=boot system; debug output still shows up on EC console Change-Id: I63f4f9481f5393aaff065b37a274236bd78622d9 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/36581 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Diffstat (limited to 'include/printf.h')
-rw-r--r--include/printf.h27
1 files changed, 19 insertions, 8 deletions
diff --git a/include/printf.h b/include/printf.h
index fdc80c2943..109fae4e2e 100644
--- a/include/printf.h
+++ b/include/printf.h
@@ -54,18 +54,29 @@
/**
* Print formatted output to a function, like vfprintf()
*
- * addchar() will be called for every character to be printed, with the context
- * pointer passed to vfnprintf(). addchar() should return 0 if the character
- * was accepted or non-zero if the character was dropped due to overflow.
- *
- * Returns error if output was truncated.
+ * @param addchar Function to be called for each character added.
+ * Will be passed the same context passed to vfnprintf(),
+ * and the character to add. Should return 0 if the
+ * character was accepted or non-zero if the character
+ * was dropped due to overflow.
+ * @param context Context pointer to pass to addchar()
+ * @param format Format string (see above for acceptable formats)
+ * @param args Parameters
+ * @return EC_SUCCESS, or non-zero if output was truncated.
*/
int vfnprintf(int (*addchar)(void *context, int c), void *context,
const char *format, va_list args);
-
-/* Print formatted outut to a string */
+/**
+ * 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
+ * @return EC_SUCCESS, or non-zero if output was truncated.
+ */
int snprintf(char *str, int size, const char *format, ...);
-
#endif /* __CROS_EC_PRINTF_H */