Subversion Repositories planix.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#include <u.h>
2
#include <libc.h>
3
 
4
#define	N	256
5
 
6
long
7
strcspn(char *s, char *b)
8
{
9
	char map[N], *os;
10
 
11
	memset(map, 0, N);
12
	for(;;) {
13
		map[*(uchar*)b] = 1;
14
		if(*b++ == 0)
15
			break;
16
	}
17
	os = s;
18
	while(map[*(uchar*)s++] == 0)
19
		;
20
	return s - os - 1;
21
}