mirror of
https://github.com/Tom-on64/kern.git
synced 2026-11-04 02:23:10 +00:00
Changed libc structure, shouldn't've added anything new
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user