summaryrefslogtreecommitdiff
path: root/lib/string/rindex.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/string/rindex.c')
-rw-r--r--lib/string/rindex.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/string/rindex.c b/lib/string/rindex.c
new file mode 100644
index 0000000..897e19e
--- /dev/null
+++ b/lib/string/rindex.c
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: MIT */
+/* Derived from musl libc (Copyright © 2005-2020 Rich Felker, et al.) */
+
+#define _BSD_SOURCE
+#include <string.h>
+#include <strings.h>
+
+char *rindex(const char *s, int c)
+{
+ return strrchr(s, c);
+}