xref: /titanic_41/usr/src/lib/libresolv2/common/bsd/strpbrk.c (revision d5ace9454616652a717c9831d949dffa319381f9)
1 /*
2  * Copyright (c) 1997-2000 by Sun Microsystems, Inc.
3  * All rights reserved.
4  */
5 
6 #if defined(LIBC_SCCS) && !defined(lint)
7 static const char sccsid[] = "@(#)strpbrk.c	8.1 (Berkeley) 6/4/93";
8 static const char rcsid[] = "$Id: strpbrk.c,v 8.4 1999/10/13 16:39:21 vixie Exp $";
9 #endif /* LIBC_SCCS and not lint */
10 
11 /*
12  * Copyright (c) 1985, 1993
13  *    The Regents of the University of California.  All rights reserved.
14  *
15  * Redistribution and use in source and binary forms, with or without
16  * modification, are permitted provided that the following conditions
17  * are met:
18  * 1. Redistributions of source code must retain the above copyright
19  *    notice, this list of conditions and the following disclaimer.
20  * 2. Redistributions in binary form must reproduce the above copyright
21  *    notice, this list of conditions and the following disclaimer in the
22  *    documentation and/or other materials provided with the distribution.
23  * 3. All advertising materials mentioning features or use of this software
24  *    must display the following acknowledgement:
25  * 	This product includes software developed by the University of
26  * 	California, Berkeley and its contributors.
27  * 4. Neither the name of the University nor the names of its contributors
28  *    may be used to endorse or promote products derived from this software
29  *    without specific prior written permission.
30  *
31  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
32  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
33  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
34  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
35  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
39  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
40  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
41  * SUCH DAMAGE.
42  */
43 
44 
45 #pragma ident	"%Z%%M%	%I%	%E% SMI"
46 
47 #include "port_before.h"
48 
49 #include <sys/param.h>
50 #include <sys/cdefs.h>
51 
52 #include <string.h>
53 
54 #include "port_after.h"
55 
56 #ifndef NEED_STRPBRK
57 int __strpbrk_unneeded__;
58 #else
59 
60 /*
61  * Find the first occurrence in s1 of a character in s2 (excluding NUL).
62  */
63 char *
64 strpbrk(const char *s1, const char *s2) {
65 	const char *scanp;
66 	int c, sc;
67 
68 	while ((c = *s1++) != 0) {
69 		for (scanp = s2; (sc = *scanp++) != 0;)
70 			if (sc == c)
71 				return ((char *)(s1 - 1));
72 	}
73 	return (NULL);
74 }
75 
76 #endif /*NEED_STRPBRK*/
77