124190Skre /* 224190Skre * Copyright (c) 1985 Regents of the University of California. 334479Sbostic * All rights reserved. 434479Sbostic * 534479Sbostic * Redistribution and use in source and binary forms are permitted 634831Sbostic * provided that the above copyright notice and this paragraph are 734831Sbostic * duplicated in all such forms and that any documentation, 834831Sbostic * advertising materials, and other materials related to such 934831Sbostic * distribution and use acknowledge that the software was developed 1034831Sbostic * by the University of California, Berkeley. The name of the 1134831Sbostic * University may not be used to endorse or promote products derived 1234831Sbostic * from this software without specific prior written permission. 1334831Sbostic * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 1434831Sbostic * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 1534831Sbostic * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 1624190Skre */ 1724190Skre 1826537Sdonn #if defined(LIBC_SCCS) && !defined(lint) 19*42181Sbostic static char sccsid[] = "@(#)strspn.c 5.5 (Berkeley) 05/17/90"; 2034479Sbostic #endif /* LIBC_SCCS and not lint */ 2124190Skre 22*42181Sbostic #include <string.h> 23*42181Sbostic 2424190Skre strspn(s, set) 2524190Skre register char *s, *set; 2624190Skre { 2724190Skre register n = 0; 2824190Skre register char *p; 2924190Skre register c; 3024190Skre 3124190Skre while (c = *s++) { 3224190Skre for (p = set; *p; p++) 3324190Skre if (c == *p) 3424190Skre break; 3524190Skre if (!*p) 3624190Skre return (n); 3724190Skre n++; 3824190Skre } 3924190Skre return (n); 4024190Skre } 41