1*2b0ebb77SConrad Meyer /*- 2*2b0ebb77SConrad Meyer * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3*2b0ebb77SConrad Meyer * 4*2b0ebb77SConrad Meyer * Copyright (c) 2019 Conrad Meyer <cem@FreeBSD.org> 5*2b0ebb77SConrad Meyer * 6*2b0ebb77SConrad Meyer * Redistribution and use in source and binary forms, with or without 7*2b0ebb77SConrad Meyer * modification, are permitted provided that the following conditions 8*2b0ebb77SConrad Meyer * are met: 9*2b0ebb77SConrad Meyer * 1. Redistributions of source code must retain the above copyright 10*2b0ebb77SConrad Meyer * notice, this list of conditions and the following disclaimer. 11*2b0ebb77SConrad Meyer * 2. Redistributions in binary form must reproduce the above copyright 12*2b0ebb77SConrad Meyer * notice, this list of conditions and the following disclaimer in the 13*2b0ebb77SConrad Meyer * documentation and/or other materials provided with the distribution. 14*2b0ebb77SConrad Meyer * 15*2b0ebb77SConrad Meyer * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16*2b0ebb77SConrad Meyer * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17*2b0ebb77SConrad Meyer * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18*2b0ebb77SConrad Meyer * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19*2b0ebb77SConrad Meyer * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20*2b0ebb77SConrad Meyer * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21*2b0ebb77SConrad Meyer * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22*2b0ebb77SConrad Meyer * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23*2b0ebb77SConrad Meyer * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24*2b0ebb77SConrad Meyer * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25*2b0ebb77SConrad Meyer * SUCH DAMAGE. 26*2b0ebb77SConrad Meyer */ 27*2b0ebb77SConrad Meyer 28*2b0ebb77SConrad Meyer #include <sys/cdefs.h> 29*2b0ebb77SConrad Meyer __FBSDID("$FreeBSD$"); 30*2b0ebb77SConrad Meyer 31*2b0ebb77SConrad Meyer #include <sys/param.h> 32*2b0ebb77SConrad Meyer #include <sys/libkern.h> 33*2b0ebb77SConrad Meyer 34*2b0ebb77SConrad Meyer char * 35*2b0ebb77SConrad Meyer strchrnul(const char *p, int ch) 36*2b0ebb77SConrad Meyer { 37*2b0ebb77SConrad Meyer 38*2b0ebb77SConrad Meyer for (; *p != 0 && *p != ch; p++) 39*2b0ebb77SConrad Meyer ; 40*2b0ebb77SConrad Meyer return (__DECONST(char *, p)); 41*2b0ebb77SConrad Meyer } 42