ref: 1a02ec3b5c4f3cb41c7a5b377c5fffa0a415e3b7
dir: /libc/utfecpy.c/
#include <u.h>
#include <libc.h>
char*
utfecpy(char *to, char *e, char *from)
{
char *end;
if(to >= e)
return to;
end = memccpy(to, from, '\0', e - to);
if(end == nil){
end = e;
while(end>to && (*--end&0xC0)==0x80)
;
*end = '\0';
}else{
end--;
}
return end;
}