Mirror of :pserver:cvs@cvs.fefe.de:/cvs libowfat https://www.fefe.de/libowfat/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

23 lines
747 B

  1. #include "fmt.h"
  2. size_t fmt_strn(char *out,const char *in,size_t limit) {
  3. register char* s=out;
  4. register const char* t=in;
  5. register const char* u=in+limit;
  6. for (;;) {
  7. if (!*t || t==u) break;
  8. if (s) { *s=*t; ++s; }
  9. ++t;
  10. if (!*t || t==u) break;
  11. if (s) { *s=*t; ++s; }
  12. ++t;
  13. if (!*t || t==u) break;
  14. if (s) { *s=*t; ++s; }
  15. ++t;
  16. if (!*t || t==u) break;
  17. if (s) { *s=*t; ++s; }
  18. ++t;
  19. }
  20. return (size_t)(t-in);
  21. }