summaryrefslogtreecommitdiffstats
path: root/pbl
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2019-09-12 07:53:12 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2019-09-12 07:53:12 +0200
commitd11999163ba62a239022d7ba98bc524730575db8 (patch)
tree3fa5bdd53229e77a9b2cac82e118cb91afe616d7 /pbl
parentd8af9462c9040c2e222d90a6003581abc8fb040e (diff)
parentb9014db5661d5a447f2d2d7717ad9be839d5e741 (diff)
downloadbarebox-d11999163ba62a239022d7ba98bc524730575db8.tar.gz
Merge branch 'for-next/qemu'
Diffstat (limited to 'pbl')
-rw-r--r--pbl/string.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/pbl/string.c b/pbl/string.c
index 927c92d..46bf0b3 100644
--- a/pbl/string.c
+++ b/pbl/string.c
@@ -133,3 +133,19 @@ size_t strnlen(const char * s, size_t count)
/* nothing */;
return sc - s;
}
+
+/**
+ * strrchr - Find the last occurrence of a character in a string
+ * @s: The string to be searched
+ * @c: The character to search for
+ */
+char * _strrchr(const char * s, int c)
+{
+ const char *p = s + strlen(s);
+
+ do {
+ if (*p == (char)c)
+ return (char *)p;
+ } while (--p >= s);
+ return NULL;
+}