Jari Aalto | 3185942 | 2009-01-12 13:36:28 +0000 | [diff] [blame] | 1 | /* strpbrk.c - locate multiple characters in a string */ |
| 2 | |
Jari Aalto | bb70624 | 2000-03-17 21:46:59 +0000 | [diff] [blame] | 3 | /* Copyright (C) 1991, 1994 Free Software Foundation, Inc. |
Jari Aalto | 3185942 | 2009-01-12 13:36:28 +0000 | [diff] [blame] | 4 | |
Jari Aalto | bb70624 | 2000-03-17 21:46:59 +0000 | [diff] [blame] | 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 | |
Jari Aalto | 3185942 | 2009-01-12 13:36:28 +0000 | [diff] [blame] | 8 | This file is part of GNU Bash, the Bourne Again SHell. |
Jari Aalto | bb70624 | 2000-03-17 21:46:59 +0000 | [diff] [blame] | 9 | |
Jari Aalto | 3185942 | 2009-01-12 13:36:28 +0000 | [diff] [blame] | 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, |
Jari Aalto | bb70624 | 2000-03-17 21:46:59 +0000 | [diff] [blame] | 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 |
Jari Aalto | 3185942 | 2009-01-12 13:36:28 +0000 | [diff] [blame] | 21 | along with Bash. If not, see <http://www.gnu.org/licenses/>. |
| 22 | */ |
Jari Aalto | bb70624 | 2000-03-17 21:46:59 +0000 | [diff] [blame] | 23 | |
| 24 | #ifdef HAVE_CONFIG_H |
| 25 | # include <config.h> |
| 26 | #endif |
| 27 | |
| 28 | #if !defined (HAVE_STRPBRK) |
| 29 | |
| 30 | #include <stdc.h> |
| 31 | |
Chet Ramey | ac50fba | 2014-02-26 09:36:43 -0500 | [diff] [blame] | 32 | /* Find the first occurrence in S of any character in ACCEPT. */ |
Jari Aalto | bb70624 | 2000-03-17 21:46:59 +0000 | [diff] [blame] | 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 |