summaryrefslogtreecommitdiffstats
path: root/usr/klibc/strrchr.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr/klibc/strrchr.c')
-rw-r--r--usr/klibc/strrchr.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/usr/klibc/strrchr.c b/usr/klibc/strrchr.c
new file mode 100644
index 0000000..af68ffe
--- /dev/null
+++ b/usr/klibc/strrchr.c
@@ -0,0 +1,23 @@
+/*
+ * strrchr.c
+ */
+
+#include <string.h>
+#include <klibc/compiler.h>
+
+char *strrchr(const char *s, int c)
+{
+ const char *found = NULL;
+
+ for (;;) {
+ if (*s == (char)c)
+ found = s;
+ if (!*s)
+ break;
+ s++;
+ }
+
+ return (char *)found;
+}
+
+__ALIAS(char *, rindex, (const char *, int), strrchr)