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.
 
 
 
 

15 lines
471 B

  1. #include "fmt.h"
  2. unsigned long fmt_strn(char *out,const char *in,unsigned long limit) {
  3. register char* s=out;
  4. register const char* t=in;
  5. register const char* u=in+limit;
  6. for (;;) {
  7. if (!*t) break; if (s) { *s=*t; ++s; } if (t==u) break; ++t;
  8. if (!*t) break; if (s) { *s=*t; ++s; } if (t==u) break; ++t;
  9. if (!*t) break; if (s) { *s=*t; ++s; } if (t==u) break; ++t;
  10. if (!*t) break; if (s) { *s=*t; ++s; } if (t==u) break; ++t;
  11. }
  12. return t-in;
  13. }