scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

strcspn.c (246B)


      1 #include <string.h>
      2 #undef strcspn
      3 
      4 size_t
      5 strcspn(const char *s1, const char *s2)
      6 {
      7 	size_t n;
      8 	int c;
      9 	const char *p;
     10 
     11 	for (n = 0; c = *s1++; ++n) {
     12 		for (p = s2; *p && *p != c; ++p)
     13 			/* nothing */;
     14 		if (*p == c)
     15 			break;
     16 	}
     17 	return n;
     18 }