Changed libc structure, shouldn't've added anything new

This commit is contained in:
2024-10-19 15:11:00 +02:00
parent e2e24d3853
commit 64b4e47d73
38 changed files with 264 additions and 276 deletions
+22
View File
@@ -0,0 +1,22 @@
#include <string.h>
char* strcpy(char* str1, const char* str2) {
char* dst = str1;
const char* src = str2;
while ((*dst++ = *src++) != '\0');
return str1;
}
char* strncpy(char* str1, const char* str2, size_t n) {
char* dst = str1;
const char* src = str2;
while (n > 0) {
n--;
if ((*dst++ = *src++) == '\0') {
memset(dst, '\0', n);
break;
}
}
return str1;
}