summaryrefslogtreecommitdiff
path: root/include/vsprintf.h
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-04-08 08:32:56 -0600
committerTom Rini <trini@konsulko.com>2020-04-24 16:40:09 -0400
commitfdc79a6b125d52b6ca0fd65df538db7810d88a8d (patch)
tree589dbab11527cbd95728f4d5c8b2990975687a28 /include/vsprintf.h
parent4f04d54981cd9d641e4ca958c551aeb00ee55484 (diff)
lib: Add a function to convert a string to upper case
Add a helper function for this operation. Update the strtoul() tests to check upper case as well. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'include/vsprintf.h')
-rw-r--r--include/vsprintf.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/vsprintf.h b/include/vsprintf.h
index 56844dd2de..d9fb68add0 100644
--- a/include/vsprintf.h
+++ b/include/vsprintf.h
@@ -222,4 +222,16 @@ bool str2long(const char *p, ulong *num);
* @hz: Value to convert
*/
char *strmhz(char *buf, unsigned long hz);
+
+/**
+ * str_to_upper() - Convert a string to upper case
+ *
+ * This simply uses toupper() on each character of the string.
+ *
+ * @in: String to convert (must be large enough to hold the output string)
+ * @out: Buffer to put converted string
+ * @len: Number of bytes available in @out (SIZE_MAX for all)
+ */
+void str_to_upper(const char *in, char *out, size_t len);
+
#endif