Bash-4.3 distribution sources and documentation
[platform/upstream/bash.git] / lib / sh / strpbrk.c
1 /* strpbrk.c - locate multiple characters in a string */
2
3 /* Copyright (C) 1991, 1994 Free Software Foundation, Inc.
4
5    NOTE: The canonical source of this file is maintained with the GNU C Library.
6    Bugs can be reported to bug-glibc@prep.ai.mit.edu.
7
8    This file is part of GNU Bash, the Bourne Again SHell.
9
10    Bash is free software: you can redistribute it and/or modify
11    it under the terms of the GNU General Public License as published by
12    the Free Software Foundation, either version 3 of the License, or
13    (at your option) any later version.
14
15    Bash is distributed in the hope that it will be useful,
16    but WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18    GNU General Public License for more details.
19
20    You should have received a copy of the GNU General Public License
21    along with Bash.  If not, see <http://www.gnu.org/licenses/>.
22 */
23
24 #ifdef HAVE_CONFIG_H
25 # include <config.h>
26 #endif
27
28 #if !defined (HAVE_STRPBRK)
29
30 #include <stdc.h>
31
32 /* Find the first occurrence in S of any character in ACCEPT.  */
33 char *
34 strpbrk (s, accept)
35      register const char *s;
36      register const char *accept;
37 {
38   while (*s != '\0')
39     {
40       const char *a = accept;
41       while (*a != '\0')
42         if (*a++ == *s)
43           return (char *) s;
44       ++s;
45     }
46
47   return 0;
48 }
49 #endif