122fec34aSEd Schouten /*-
251369649SPedro F. Giffuni * SPDX-License-Identifier: BSD-3-Clause
351369649SPedro F. Giffuni *
422fec34aSEd Schouten * Copyright (c) 1990, 1993
522fec34aSEd Schouten * The Regents of the University of California. All rights reserved.
622fec34aSEd Schouten *
722fec34aSEd Schouten * Redistribution and use in source and binary forms, with or without
822fec34aSEd Schouten * modification, are permitted provided that the following conditions
922fec34aSEd Schouten * are met:
1022fec34aSEd Schouten * 1. Redistributions of source code must retain the above copyright
1122fec34aSEd Schouten * notice, this list of conditions and the following disclaimer.
1222fec34aSEd Schouten * 2. Redistributions in binary form must reproduce the above copyright
1322fec34aSEd Schouten * notice, this list of conditions and the following disclaimer in the
1422fec34aSEd Schouten * documentation and/or other materials provided with the distribution.
15fbbd9655SWarner Losh * 3. Neither the name of the University nor the names of its contributors
1622fec34aSEd Schouten * may be used to endorse or promote products derived from this software
1722fec34aSEd Schouten * without specific prior written permission.
1822fec34aSEd Schouten *
1922fec34aSEd Schouten * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2022fec34aSEd Schouten * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2122fec34aSEd Schouten * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2222fec34aSEd Schouten * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2322fec34aSEd Schouten * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2422fec34aSEd Schouten * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2522fec34aSEd Schouten * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2622fec34aSEd Schouten * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2722fec34aSEd Schouten * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2822fec34aSEd Schouten * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2922fec34aSEd Schouten * SUCH DAMAGE.
3022fec34aSEd Schouten */
3122fec34aSEd Schouten
3222fec34aSEd Schouten #include <sys/param.h>
3322fec34aSEd Schouten #include <sys/libkern.h>
3422fec34aSEd Schouten
3522fec34aSEd Schouten char *
strchr(const char * cp,int ch)36*3d825c42SConrad Meyer strchr(const char *cp, int ch)
3722fec34aSEd Schouten {
3822fec34aSEd Schouten char *p;
3922fec34aSEd Schouten
40*3d825c42SConrad Meyer p = __DECONST(char *, cp);
41*3d825c42SConrad Meyer for (;; ++p) {
42*3d825c42SConrad Meyer if (*p == ch)
43*3d825c42SConrad Meyer return (p);
44*3d825c42SConrad Meyer if (*p == '\0')
4522fec34aSEd Schouten return (NULL);
4622fec34aSEd Schouten }
4722fec34aSEd Schouten /* NOTREACHED */
4822fec34aSEd Schouten }
49