146632c18SEd Schouten /*- 2*7f72497eSEd Maste * SPDX-License-Identifier: MIT 38a16b7a1SPedro F. Giffuni * 4*7f72497eSEd Maste * Copyright (c) 2005-2014 Rich Felker, et al. 546632c18SEd Schouten * 6*7f72497eSEd Maste * Permission is hereby granted, free of charge, to any person obtaining 7*7f72497eSEd Maste * a copy of this software and associated documentation files (the 8*7f72497eSEd Maste * "Software"), to deal in the Software without restriction, including 9*7f72497eSEd Maste * without limitation the rights to use, copy, modify, merge, publish, 10*7f72497eSEd Maste * distribute, sublicense, and/or sell copies of the Software, and to 11*7f72497eSEd Maste * permit persons to whom the Software is furnished to do so, subject to 12*7f72497eSEd Maste * the following conditions: 1346632c18SEd Schouten * 14*7f72497eSEd Maste * The above copyright notice and this permission notice shall be 15*7f72497eSEd Maste * included in all copies or substantial portions of the Software. 16*7f72497eSEd Maste * 17*7f72497eSEd Maste * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18*7f72497eSEd Maste * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19*7f72497eSEd Maste * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20*7f72497eSEd Maste * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 21*7f72497eSEd Maste * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22*7f72497eSEd Maste * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23*7f72497eSEd Maste * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 2446632c18SEd Schouten */ 25333fc21eSDavid E. O'Brien #include <sys/cdefs.h> 26333fc21eSDavid E. O'Brien __FBSDID("$FreeBSD$"); 27333fc21eSDavid E. O'Brien 2846632c18SEd Schouten #include <string.h> 2946632c18SEd Schouten 30*7f72497eSEd Maste char *__strchrnul(const char *, int); 3146632c18SEd Schouten 32*7f72497eSEd Maste char * 33*7f72497eSEd Maste strchr(const char *s, int c) 34*7f72497eSEd Maste { 35*7f72497eSEd Maste char *r = __strchrnul(s, c); 36*7f72497eSEd Maste return *(unsigned char *)r == (unsigned char)c ? r : NULL; 3746632c18SEd Schouten } 3846632c18SEd Schouten 3919c262feSEd Schouten __weak_reference(strchr, index); 40