ref: bc7d74f09b53c39ada4e73ce73c01c6c0928f9f4
dir: /sys/src/libc/port/strcspn.c/
#include <u.h>
#include <libc.h>
#define N 256
long
strcspn(char *s, char *b)
{
char map[N], *os;
memset(map, 0, N);
for(;;) {
map[*(uchar*)b] = 1;
if(*b++ == 0)
break;
}
os = s;
while(map[*(uchar*)s++] == 0)
;
return s - os - 1;
}