diff --git a/headers/posix/string.h b/headers/posix/string.h index 802abcd522..8e29ca49fe 100644 --- a/headers/posix/string.h +++ b/headers/posix/string.h @@ -78,6 +78,8 @@ extern const char *strsignal(int signal); #define bzero(buffer, length) memset((buffer), 0, (length)) extern int ffs(int i); +extern char *index(const char *s, int c); +extern char *rindex(char const *s, int c); #ifdef __cplusplus } diff --git a/src/system/libroot/posix/string/strchr.c b/src/system/libroot/posix/string/strchr.c index a914b961d4..fec3cd6e92 100644 --- a/src/system/libroot/posix/string/strchr.c +++ b/src/system/libroot/posix/string/strchr.c @@ -16,3 +16,10 @@ strchr(const char *s, int c) return (char *)s; } + +char * +index(const char *s, int c) +{ + return strchr(s, c); +} + diff --git a/src/system/libroot/posix/string/strrchr.c b/src/system/libroot/posix/string/strrchr.c index be8ab086c0..a2abeb86f0 100644 --- a/src/system/libroot/posix/string/strrchr.c +++ b/src/system/libroot/posix/string/strrchr.c @@ -22,3 +22,11 @@ strrchr(char const *s, int c) return (char *)last; } + + +char * +rindex(char const *s, int c) +{ + return strrchr(s, c); +} +