1 #include <u.h> 2 #include <libc.h> 3 4 char* strecpy(char * to,char * e,char * from)5 strecpy(char *to, char *e, char *from) 6 { 7 if(to >= e) 8 return to; 9 to = memccpy(to, from, '\0', e - to); 10 if(to == nil){ 11 to = e - 1; 12 *to = '\0'; 13 }else{ 14 to--; 15 } 16 return to; 17 } 18