1c6fdaa73SAntonio Nino Diaz /*-
2c6fdaa73SAntonio Nino Diaz * SPDX-License-Identifier: BSD-3-Clause
3c6fdaa73SAntonio Nino Diaz *
4c6fdaa73SAntonio Nino Diaz * Copyright (c) 1990, 1993
5c6fdaa73SAntonio Nino Diaz * The Regents of the University of California. All rights reserved.
6c6fdaa73SAntonio Nino Diaz *
7c6fdaa73SAntonio Nino Diaz * Redistribution and use in source and binary forms, with or without
8c6fdaa73SAntonio Nino Diaz * modification, are permitted provided that the following conditions
9c6fdaa73SAntonio Nino Diaz * are met:
10c6fdaa73SAntonio Nino Diaz * 1. Redistributions of source code must retain the above copyright
11c6fdaa73SAntonio Nino Diaz * notice, this list of conditions and the following disclaimer.
12c6fdaa73SAntonio Nino Diaz * 2. Redistributions in binary form must reproduce the above copyright
13c6fdaa73SAntonio Nino Diaz * notice, this list of conditions and the following disclaimer in the
14c6fdaa73SAntonio Nino Diaz * documentation and/or other materials provided with the distribution.
15c6fdaa73SAntonio Nino Diaz * 3. Neither the name of the University nor the names of its contributors
16c6fdaa73SAntonio Nino Diaz * may be used to endorse or promote products derived from this software
17c6fdaa73SAntonio Nino Diaz * without specific prior written permission.
18c6fdaa73SAntonio Nino Diaz *
19c6fdaa73SAntonio Nino Diaz * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20c6fdaa73SAntonio Nino Diaz * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21c6fdaa73SAntonio Nino Diaz * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22c6fdaa73SAntonio Nino Diaz * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23c6fdaa73SAntonio Nino Diaz * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24c6fdaa73SAntonio Nino Diaz * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25c6fdaa73SAntonio Nino Diaz * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26c6fdaa73SAntonio Nino Diaz * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27c6fdaa73SAntonio Nino Diaz * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28c6fdaa73SAntonio Nino Diaz * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29c6fdaa73SAntonio Nino Diaz * SUCH DAMAGE.
30c6fdaa73SAntonio Nino Diaz */
31c6fdaa73SAntonio Nino Diaz
322c5aca6eSAntonio Nino Diaz /*
33*34d7f196SBoyan Karatotev * Portions copyright (c) 2018-2025, Arm Limited and Contributors.
342c5aca6eSAntonio Nino Diaz * All rights reserved.
352c5aca6eSAntonio Nino Diaz */
36c6fdaa73SAntonio Nino Diaz
37c6fdaa73SAntonio Nino Diaz #include <stddef.h>
38*34d7f196SBoyan Karatotev #include <string_private.h>
39c6fdaa73SAntonio Nino Diaz
40c6fdaa73SAntonio Nino Diaz char *
strchr(const char * p,int ch)41c6fdaa73SAntonio Nino Diaz strchr(const char *p, int ch)
42c6fdaa73SAntonio Nino Diaz {
43c6fdaa73SAntonio Nino Diaz char c;
44c6fdaa73SAntonio Nino Diaz
45c6fdaa73SAntonio Nino Diaz c = ch;
46c6fdaa73SAntonio Nino Diaz for (;; ++p) {
47c6fdaa73SAntonio Nino Diaz if (*p == c)
48c6fdaa73SAntonio Nino Diaz return ((char *)p);
49c6fdaa73SAntonio Nino Diaz if (*p == '\0')
50c6fdaa73SAntonio Nino Diaz return (NULL);
51c6fdaa73SAntonio Nino Diaz }
52c6fdaa73SAntonio Nino Diaz /* NOTREACHED */
53c6fdaa73SAntonio Nino Diaz }
54