diff options
author | dzwdz | 2023-08-24 19:10:35 +0200 |
---|---|---|
committer | dzwdz | 2023-08-24 19:10:35 +0200 |
commit | 3e09037780ca95633749be3acd52e817eed7f98c (patch) | |
tree | 83bcf5026cd4383809c81c5f38473a6b1e46755e /src/libc/string | |
parent | 292b2386d766826b15f5ca084d37aa2c485fdda6 (diff) |
libc: get most of binutils to compile
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; } |