xref: /csrg-svn/lib/libc/string/strpbrk.c (revision 61193)
124191Skre /*
2*61193Sbostic  * Copyright (c) 1985, 1993
3*61193Sbostic  *	The Regents of the University of California.  All rights reserved.
434479Sbostic  *
542637Sbostic  * %sccs.include.redist.c%
624191Skre  */
724191Skre 
826535Sdonn #if defined(LIBC_SCCS) && !defined(lint)
9*61193Sbostic static char sccsid[] = "@(#)strpbrk.c	8.1 (Berkeley) 06/04/93";
1034479Sbostic #endif /* LIBC_SCCS and not lint */
1124191Skre 
1246144Sbostic #include <sys/cdefs.h>
1342169Sbostic #include <string.h>
1442169Sbostic 
1542169Sbostic /*
1642169Sbostic  * Find the first occurrence in s1 of a character in s2 (excluding NUL).
1742169Sbostic  */
1824191Skre char *
strpbrk(s1,s2)1937776Sbostic strpbrk(s1, s2)
2042169Sbostic 	register const char *s1, *s2;
2124191Skre {
2242169Sbostic 	register const char *scanp;
2337776Sbostic 	register int c, sc;
2424191Skre 
2542169Sbostic 	while ((c = *s1++) != 0) {
2642169Sbostic 		for (scanp = s2; (sc = *scanp++) != 0;)
2737776Sbostic 			if (sc == c)
2842169Sbostic 				return ((char *)(s1 - 1));
2942169Sbostic 	}
3042169Sbostic 	return (NULL);
3124191Skre }
32