124190Skre /* 2*61193Sbostic * Copyright (c) 1989, 1993 3*61193Sbostic * The Regents of the University of California. All rights reserved. 434479Sbostic * 542637Sbostic * %sccs.include.redist.c% 624190Skre */ 724190Skre 826537Sdonn #if defined(LIBC_SCCS) && !defined(lint) 9*61193Sbostic static char sccsid[] = "@(#)strspn.c 8.1 (Berkeley) 06/04/93"; 1034479Sbostic #endif /* LIBC_SCCS and not lint */ 1124190Skre 1246144Sbostic #include <sys/cdefs.h> 1342181Sbostic #include <string.h> 1442181Sbostic 1542190Sbostic /* 1642190Sbostic * Span the string s2 (skip characters that are in s2). 1742190Sbostic */ 1842190Sbostic size_t strspn(s1,s2)1942190Sbosticstrspn(s1, s2) 2042190Sbostic const char *s1; 2142190Sbostic register const char *s2; 2224190Skre { 2342190Sbostic register const char *p = s1, *spanp; 2442190Sbostic register char c, sc; 2524190Skre 2642190Sbostic /* 2742190Sbostic * Skip any characters in s2, excluding the terminating \0. 2842190Sbostic */ 2942190Sbostic cont: 3042190Sbostic c = *p++; 3142190Sbostic for (spanp = s2; (sc = *spanp++) != 0;) 3242190Sbostic if (sc == c) 3342190Sbostic goto cont; 3442190Sbostic return (p - 1 - s1); 3524190Skre } 36