]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - include/vsprintf.h
karo: fdt: fix panel-dpi support
[karo-tx-uboot.git] / include / vsprintf.h
index 09c8abd951d09c48ea8b937542549c25efb8ad79..b5bc9c1d95fab6c09d6cf637202b10ae57e9f85f 100644 (file)
@@ -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
  *
@@ -196,4 +222,6 @@ int vscnprintf(char *buf, size_t size, const char *fmt, va_list args);
  */
 void print_grouped_ull(unsigned long long int_val, int digits);
 
+bool str2off(const char *p, loff_t *num);
+bool str2long(const char *p, ulong *num);
 #endif