diff --git a/Userspace/libc/include/string.h b/Userspace/libc/include/string.h index 72e05dfe..59ce07c4 100644 --- a/Userspace/libc/include/string.h +++ b/Userspace/libc/include/string.h @@ -40,7 +40,7 @@ extern "C" int strcmp(const char *s1, const char *s2); int strcoll(const char *s1, const char *s2); int strcoll_l(const char *, const char *, locale_t); - char *strcpy(char *restrict, const char *restrict); + char *strcpy(char *restrict s1, const char *restrict s2); size_t strcspn(const char *s1, const char *s2); char *strdup(const char *); char *strerror(int); diff --git a/Userspace/libc/src/std/string.c b/Userspace/libc/src/std/string.c index e90bd788..c24cc099 100644 --- a/Userspace/libc/src/std/string.c +++ b/Userspace/libc/src/std/string.c @@ -84,7 +84,15 @@ export int strcoll(const char *s1, const char *s2) } export int strcoll_l(const char *, const char *, locale_t); -export char *strcpy(char *restrict, const char *restrict); + +export char *strcpy(char *restrict s1, const char *restrict s2) +{ + char *dest = s1; + while (*s2) + *dest++ = *s2++; + *dest = '\0'; + return s1; +} export size_t strcspn(const char *s1, const char *s2) {