strecpy.c 193 B

1234567891011121314
  1. #include <plan9.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. }
  12. return to;
  13. }