strecpy.c 208 B

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