25 lines
503 B
C
25 lines
503 B
C
#if !defined(lint) && defined(SCCSIDS)
|
|
static char sccsid[] = "@(#)strspn.c 1.1 92/07/30 SMI"; /* from S5R2 1.2 */
|
|
#endif
|
|
|
|
/*LINTLIBRARY*/
|
|
/*
|
|
* Return the number of characters in the maximum leading segment
|
|
* of string which consists solely of characters from charset.
|
|
*/
|
|
int
|
|
strspn(string, charset)
|
|
char *string;
|
|
register char *charset;
|
|
{
|
|
register char *p, *q;
|
|
|
|
for(q=string; *q != '\0'; ++q) {
|
|
for(p=charset; *p != '\0' && *p != *q; ++p)
|
|
;
|
|
if(*p == '\0')
|
|
break;
|
|
}
|
|
return(q-string);
|
|
}
|