X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=include%2Fvsprintf.h;h=376f5dd32499d54eac281435b9ab24cf2aeb8c3f;hb=95ebc253e6d4a3370e3dab14743bfc99fcd9cf1b;hp=d2fcca3f5a78e7f63ec4cfabaeb2c4cc3654092a;hpb=09c3280754f8f68a4d7fc0ee397a92b38c4f59e4;p=u-boot diff --git a/include/vsprintf.h b/include/vsprintf.h index d2fcca3f5a..376f5dd324 100644 --- a/include/vsprintf.h +++ b/include/vsprintf.h @@ -40,6 +40,32 @@ unsigned long long simple_strtoull(const char *cp, char **endp, unsigned int base); long simple_strtol(const char *cp, char **endp, unsigned int base); +/** + * trailing_strtol() - extract a trailing integer from a string + * + * Given a string this finds a trailing number on the string and returns it. + * For example, "abc123" would return 123. + * + * @str: String to exxamine + * @return training number if found, else -1 + */ +long trailing_strtol(const char *str); + +/** + * trailing_strtoln() - extract a trailing integer from a fixed-length string + * + * Given a fixed-length string this finds a trailing number on the string + * and returns it. For example, "abc123" would return 123. Only the + * characters between @str and @end - 1 are examined. If @end is NULL, it is + * set to str + strlen(str). + * + * @str: String to exxamine + * @end: Pointer to end of string to examine, or NULL to use the + * whole string + * @return training number if found, else -1 + */ +long trailing_strtoln(const char *str, const char *end); + /** * panic() - Print a message and reset/hang * @@ -98,7 +124,6 @@ int sprintf(char *buf, const char *fmt, ...) int vsprintf(char *buf, const char *fmt, va_list args); char *simple_itoa(ulong i); -#ifdef CONFIG_SYS_VSNPRINTF /** * Format a string and place it in a buffer * @@ -173,17 +198,6 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args); * See the vsprintf() documentation for format string extensions over C99. */ int vscnprintf(char *buf, size_t size, const char *fmt, va_list args); -#else -/* - * Use macros to silently drop the size parameter. Note that the 'cn' - * versions are the same as the 'n' versions since the functions assume - * there is always enough buffer space when !CONFIG_SYS_VSNPRINTF - */ -#define snprintf(buf, size, fmt, args...) sprintf(buf, fmt, ##args) -#define scnprintf(buf, size, fmt, args...) sprintf(buf, fmt, ##args) -#define vsnprintf(buf, size, fmt, args...) vsprintf(buf, fmt, ##args) -#define vscnprintf(buf, size, fmt, args...) vsprintf(buf, fmt, ##args) -#endif /* CONFIG_SYS_VSNPRINTF */ /** * print_grouped_ull() - print a value with digits grouped by ','