diff options
Diffstat (limited to 'src/libc/string')
-rw-r--r-- | src/libc/string/string.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/libc/string/string.c b/src/libc/string/string.c index c65d7c5..ac1c757 100644 --- a/src/libc/string/string.c +++ b/src/libc/string/string.c @@ -1,3 +1,4 @@ +#include <bits/panic.h> #include <ctype.h> #include <errno.h> #include <stdlib.h> @@ -79,10 +80,15 @@ char *strstr(const char *s1, const char *s2) { return NULL; } +char *strcat(char *restrict dst, const char *restrict src) { + return strcpy(dst + strlen(dst), src); +} + char *strcpy(char *restrict s1, const char *restrict s2) { + char *ret = s1; while (*s2) *s1++ = *s2++; *s1 = *s2; - return s1; + return ret; } char *strncpy(char *restrict dst, const char *restrict src, size_t n) { @@ -93,6 +99,11 @@ char *strncpy(char *restrict dst, const char *restrict src, size_t n) { return dst; } +char *strncat(char *restrict dst, const char *restrict src, size_t n) { + (void)dst; (void)src; (void)n; + __libc_panic("unimplemented"); +} + char *stpncpy(char *restrict dst, const char *restrict src, size_t n) { return stpncpy(dst, src, n) + n; } |