diff options
author | Marvin Borner | 2021-01-07 21:06:19 +0100 |
---|---|---|
committer | Marvin Borner | 2021-01-07 21:06:19 +0100 |
commit | 80af2772db61a1ae52caf1194dd955d6263441f2 (patch) | |
tree | b88d5c4f4a5a88e7d7252f0d9892abd8b21c259d /libc | |
parent | 9fad5e3bb718c5892ec72de42977886233721cb9 (diff) |
Working VFS path resolving
Diffstat (limited to 'libc')
-rw-r--r-- | libc/inc/str.h | 1 | ||||
-rw-r--r-- | libc/str.c | 12 |
2 files changed, 13 insertions, 0 deletions
diff --git a/libc/inc/str.h b/libc/inc/str.h index 3156fb2..662cbe7 100644 --- a/libc/inc/str.h +++ b/libc/inc/str.h @@ -9,6 +9,7 @@ u32 strlen(const char *s); char *strcpy(char *dst, const char *src); char *strncpy(char *dst, const char *src, u32 n); char *strchr(const char *s, int c); +char *strrchr(const char *s, int c); char *strcat(char *dst, const char *src); char *strncat(char *dst, const char *src, u32 n); int strcmp(const char *s1, const char *s2); @@ -77,6 +77,18 @@ char *strchr(const char *s, int c) return (char *)s; } +char *strrchr(const char *s, int c) +{ + char *ret = 0; + + do { + if (*s == c) + ret = (char *)s; + } while (*s++); + + return ret; +} + char *strcat(char *dst, const char *src) { strcpy(strchr(dst, '\0'), src); |