12b0ebb77SConrad Meyer /*- 2*4d846d26SWarner Losh * SPDX-License-Identifier: BSD-2-Clause 32b0ebb77SConrad Meyer * 42b0ebb77SConrad Meyer * Copyright (c) 2019 Conrad Meyer <cem@FreeBSD.org> 52b0ebb77SConrad Meyer * 62b0ebb77SConrad Meyer * Redistribution and use in source and binary forms, with or without 72b0ebb77SConrad Meyer * modification, are permitted provided that the following conditions 82b0ebb77SConrad Meyer * are met: 92b0ebb77SConrad Meyer * 1. Redistributions of source code must retain the above copyright 102b0ebb77SConrad Meyer * notice, this list of conditions and the following disclaimer. 112b0ebb77SConrad Meyer * 2. Redistributions in binary form must reproduce the above copyright 122b0ebb77SConrad Meyer * notice, this list of conditions and the following disclaimer in the 132b0ebb77SConrad Meyer * documentation and/or other materials provided with the distribution. 142b0ebb77SConrad Meyer * 152b0ebb77SConrad Meyer * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 162b0ebb77SConrad Meyer * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 172b0ebb77SConrad Meyer * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 182b0ebb77SConrad Meyer * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 192b0ebb77SConrad Meyer * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 202b0ebb77SConrad Meyer * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 212b0ebb77SConrad Meyer * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 222b0ebb77SConrad Meyer * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 232b0ebb77SConrad Meyer * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 242b0ebb77SConrad Meyer * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 252b0ebb77SConrad Meyer * SUCH DAMAGE. 262b0ebb77SConrad Meyer */ 272b0ebb77SConrad Meyer 282b0ebb77SConrad Meyer #include <sys/cdefs.h> 292b0ebb77SConrad Meyer __FBSDID("$FreeBSD$"); 302b0ebb77SConrad Meyer 312b0ebb77SConrad Meyer #include <sys/param.h> 322b0ebb77SConrad Meyer #include <sys/libkern.h> 332b0ebb77SConrad Meyer 342b0ebb77SConrad Meyer char * 352b0ebb77SConrad Meyer strchrnul(const char *p, int ch) 362b0ebb77SConrad Meyer { 372b0ebb77SConrad Meyer 382b0ebb77SConrad Meyer for (; *p != 0 && *p != ch; p++) 392b0ebb77SConrad Meyer ; 402b0ebb77SConrad Meyer return (__DECONST(char *, p)); 412b0ebb77SConrad Meyer } 42