|
|
1.1 root 1: /* @(#)strspn.c 1.2 */
2: /*LINTLIBRARY*/
3: /*
4: * Return the number of characters in the maximum leading segment
5: * of string which consists solely of characters from charset.
6: */
7: int
8: strspn(string, charset)
9: char *string;
10: register char *charset;
11: {
12: register char *p, *q;
13:
14: for(q=string; *q != '\0'; ++q) {
15: for(p=charset; *p != '\0' && *p != *q; ++p)
16: ;
17: if(*p == '\0')
18: break;
19: }
20: return(q-string);
21: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.