toaruos/libc/string/strxfrm.c
2018-10-12 10:35:28 +09:00

20 lines
299 B
C

#include <string.h>
/**
* We only really support the "C" locale, so this is always
* just a dumb memcpy.
*/
size_t strxfrm(char *dest, const char *src, size_t n) {
size_t i = 0;
while (*src && i < n) {
*dest = *src;
dest++;
src++;
i++;
}
if (i < n) {
*dest = '\0';
}
return i;
}