From fdc79a6b125d52b6ca0fd65df538db7810d88a8d Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 8 Apr 2020 08:32:56 -0600 Subject: 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 Reviewed-by: Heinrich Schuchardt --- include/vsprintf.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'include') 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 -- cgit v1.2.1