1 /*
2 Copyright (c) 1994 Cygnus Support.
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms are permitted
6 provided that the above copyright notice and this paragraph are
7 duplicated in all such forms and that any documentation,
8 and/or other materials related to such
9 distribution and use acknowledge that the software was developed
10 at Cygnus Support, Inc.  Cygnus Support, Inc. may not be used to
11 endorse or promote products derived from this software without
12 specific prior written permission.
13 THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14 IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16  */
17 /*
18 FUNCTION
19 	<<strpbrk>>---find characters in string
20 
21 INDEX
22 	strpbrk
23 
24 SYNOPSIS
25 	#include <string.h>
26 	char *strpbrk(const char *<[s1]>, const char *<[s2]>);
27 
28 DESCRIPTION
29 	This function locates the first occurence in the string
30 	pointed to by <[s1]> of any character in string pointed to by
31 	<[s2]> (excluding the terminating null character).
32 
33 RETURNS
34 	<<strpbrk>> returns a pointer to the character found in <[s1]>, or a
35 	null pointer if no character from <[s2]> occurs in <[s1]>.
36 
37 PORTABILITY
38 <<strpbrk>> requires no supporting OS subroutines.
39 */
40 
41 #include <string.h>
42 
43 char *
strpbrk(const char * s1,const char * s2)44 strpbrk (const char *s1,
45 	const char *s2)
46 {
47   const char *c = s2;
48 
49   while (*s1)
50     {
51       for (c = s2; *c; c++)
52 	{
53 	  if (*s1 == *c)
54 	    return (char *) s1;
55 	}
56       s1++;
57     }
58 
59   return (char *) NULL;
60 }
61