scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | README | LICENSE

strnlen.c (151B)


      1 #include <string.h>
      2 
      3 #undef strnlen
      4 
      5 size_t
      6 strnlen(const char *s, size_t maxlen)
      7 {
      8 	size_t n;
      9 
     10 	for (n = 0; n < maxlen && *s++; ++n)
     11 		;
     12 	return n;
     13 }