scc

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

strpbrk.c (341B)


      1 #include <string.h>
      2 #undef strpbrk
      3 
      4 char *
      5 strpbrk(const char *s1, const char *s2)
      6 {
      7 	const unsigned char *s = s1;
      8 	const unsigned char *accept = s2;
      9 	unsigned ch;
     10 	char buf[__NUMCHARS];
     11 
     12 	memset(buf, 0, sizeof(buf));
     13 	while (ch = *accept++)
     14 		buf[ch] = 1;
     15 
     16 	while ((ch = *s) && !buf[ch])
     17 		s++;
     18 
     19 	return (ch == '\0') ? NULL : (char *) s;
     20 }