blob: 8cce8308ed30f0238745df28d098f2cca5a05e56 [file] [log] [blame]
Jari Aalto31859422009-01-12 13:36:28 +00001/* strpbrk.c - locate multiple characters in a string */
2
Jari Aaltobb706242000-03-17 21:46:59 +00003/* Copyright (C) 1991, 1994 Free Software Foundation, Inc.
Jari Aalto31859422009-01-12 13:36:28 +00004
Jari Aaltobb706242000-03-17 21:46:59 +00005 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
Jari Aalto31859422009-01-12 13:36:28 +00008 This file is part of GNU Bash, the Bourne Again SHell.
Jari Aaltobb706242000-03-17 21:46:59 +00009
Jari Aalto31859422009-01-12 13:36:28 +000010 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,
Jari Aaltobb706242000-03-17 21:46:59 +000016 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
Jari Aalto31859422009-01-12 13:36:28 +000021 along with Bash. If not, see <http://www.gnu.org/licenses/>.
22*/
Jari Aaltobb706242000-03-17 21:46:59 +000023
24#ifdef HAVE_CONFIG_H
25# include <config.h>
26#endif
27
28#if !defined (HAVE_STRPBRK)
29
30#include <stdc.h>
31
Chet Rameyac50fba2014-02-26 09:36:43 -050032/* Find the first occurrence in S of any character in ACCEPT. */
Jari Aaltobb706242000-03-17 21:46:59 +000033char *
34strpbrk (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