xref: /netbsd-src/external/gpl2/gettext/dist/gettext-tools/gnulib-lib/strpbrk.c (revision 946379e7b37692fc43f68eb0d1c10daa0a7f3b6c)
1*946379e7Schristos /* Copyright (C) 1991, 1994, 2000, 2002-2003, 2006 Free Software
2*946379e7Schristos    Foundation, Inc.
3*946379e7Schristos 
4*946379e7Schristos    NOTE: The canonical source of this file is maintained with the GNU C Library.
5*946379e7Schristos    Bugs can be reported to bug-glibc@prep.ai.mit.edu.
6*946379e7Schristos 
7*946379e7Schristos    This program is free software; you can redistribute it and/or modify it
8*946379e7Schristos    under the terms of the GNU General Public License as published by the
9*946379e7Schristos    Free Software Foundation; either version 2, or (at your option) any
10*946379e7Schristos    later version.
11*946379e7Schristos 
12*946379e7Schristos    This program is distributed in the hope that it will be useful,
13*946379e7Schristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
14*946379e7Schristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15*946379e7Schristos    GNU General Public License for more details.
16*946379e7Schristos 
17*946379e7Schristos    You should have received a copy of the GNU General Public License
18*946379e7Schristos    along with this program; if not, write to the Free Software Foundation,
19*946379e7Schristos    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
20*946379e7Schristos 
21*946379e7Schristos #include <config.h>
22*946379e7Schristos 
23*946379e7Schristos #include <stddef.h>
24*946379e7Schristos #include <string.h>
25*946379e7Schristos 
26*946379e7Schristos #undef strpbrk
27*946379e7Schristos 
28*946379e7Schristos /* Find the first occurrence in S of any character in ACCEPT.  */
29*946379e7Schristos char *
strpbrk(const char * s,const char * accept)30*946379e7Schristos strpbrk (const char *s, const char *accept)
31*946379e7Schristos {
32*946379e7Schristos   while (*s != '\0')
33*946379e7Schristos     {
34*946379e7Schristos       const char *a = accept;
35*946379e7Schristos       while (*a != '\0')
36*946379e7Schristos 	if (*a++ == *s)
37*946379e7Schristos 	  return (char *) s;
38*946379e7Schristos       ++s;
39*946379e7Schristos     }
40*946379e7Schristos 
41*946379e7Schristos   return NULL;
42*946379e7Schristos }
43