49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby/*
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby * Copyright (c) 1985, 1993
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby * The Regents of the University of California. All rights reserved.
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby *
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby * Redistribution and use in source and binary forms, with or without
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby * modification, are permitted provided that the following conditions
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby * are met:
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby * 1. Redistributions of source code must retain the above copyright
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby * notice, this list of conditions and the following disclaimer.
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby * 2. Redistributions in binary form must reproduce the above copyright
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby * notice, this list of conditions and the following disclaimer in the
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby * documentation and/or other materials provided with the distribution.
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby * 3. Neither the name of the University nor the names of its contributors
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby * may be used to endorse or promote products derived from this software
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby * without specific prior written permission.
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby *
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
f6e214c7418f43af38bd8c3a557e3d0a1d311cfaGavin Maltby * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
fc5ba5b7841bf3fe7e5fd01506a94a559ea518cdAntonello Cruz * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
fc5ba5b7841bf3fe7e5fd01506a94a559ea518cdAntonello Cruz * SUCH DAMAGE.
fc5ba5b7841bf3fe7e5fd01506a94a559ea518cdAntonello Cruz */
fc5ba5b7841bf3fe7e5fd01506a94a559ea518cdAntonello Cruz
fc5ba5b7841bf3fe7e5fd01506a94a559ea518cdAntonello Cruz#if defined(LIBC_SCCS) && !defined(lint)
fc5ba5b7841bf3fe7e5fd01506a94a559ea518cdAntonello Cruzstatic char sccsid[] = "@(#)strpbrk.c 8.1 (Berkeley) 6/4/93";
fc5ba5b7841bf3fe7e5fd01506a94a559ea518cdAntonello Cruz#endif /* LIBC_SCCS and not lint */
fc5ba5b7841bf3fe7e5fd01506a94a559ea518cdAntonello Cruz#include <sys/cdefs.h>
fc5ba5b7841bf3fe7e5fd01506a94a559ea518cdAntonello Cruz__FBSDID("$FreeBSD$");
fc5ba5b7841bf3fe7e5fd01506a94a559ea518cdAntonello Cruz
fc5ba5b7841bf3fe7e5fd01506a94a559ea518cdAntonello Cruz#include <string.h>
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby
f6e214c7418f43af38bd8c3a557e3d0a1d311cfaGavin Maltby/*
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby * Find the first occurrence in s1 of a character in s2 (excluding NUL).
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby */
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltbychar *
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltbystrpbrk(const char *s1, const char *s2)
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby{
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby const char *scanp;
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby int c, sc;
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby while ((c = *s1++) != 0) {
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby for (scanp = s2; (sc = *scanp++) != '\0';)
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby if (sc == c)
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby return ((char *)(s1 - 1));
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby }
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby return (NULL);
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby}
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby