1*b5be37d2Sderaadt /* $OpenBSD: strchr.c,v 1.5 2014/06/10 04:16:57 deraadt Exp $ */
2125da6d1Sderaadt
3125da6d1Sderaadt /*
4125da6d1Sderaadt * Copyright (c) 2004 Daniel Hartmeier
5125da6d1Sderaadt * All rights reserved.
6125da6d1Sderaadt *
7125da6d1Sderaadt * Redistribution and use in source and binary forms, with or without
8125da6d1Sderaadt * modification, are permitted provided that the following conditions
9125da6d1Sderaadt * are met:
10125da6d1Sderaadt *
11125da6d1Sderaadt * - Redistributions of source code must retain the above copyright
12125da6d1Sderaadt * notice, this list of conditions and the following disclaimer.
13125da6d1Sderaadt * - Redistributions in binary form must reproduce the above
14125da6d1Sderaadt * copyright notice, this list of conditions and the following
15125da6d1Sderaadt * disclaimer in the documentation and/or other materials provided
16125da6d1Sderaadt * with the distribution.
17125da6d1Sderaadt *
18125da6d1Sderaadt * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19125da6d1Sderaadt * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20125da6d1Sderaadt * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21125da6d1Sderaadt * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22125da6d1Sderaadt * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23125da6d1Sderaadt * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24125da6d1Sderaadt * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25125da6d1Sderaadt * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26125da6d1Sderaadt * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27125da6d1Sderaadt * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28125da6d1Sderaadt * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29125da6d1Sderaadt * POSSIBILITY OF SUCH DAMAGE.
30125da6d1Sderaadt *
31125da6d1Sderaadt */
32125da6d1Sderaadt
33125da6d1Sderaadt #include <sys/types.h>
34125da6d1Sderaadt #include <lib/libkern/libkern.h>
35125da6d1Sderaadt #define NULL ((char *)0)
36125da6d1Sderaadt
37125da6d1Sderaadt char *
strchr(const char * s,int c)38125da6d1Sderaadt strchr(const char *s, int c)
39125da6d1Sderaadt {
40125da6d1Sderaadt while (*s) {
41125da6d1Sderaadt if (*s == c)
42125da6d1Sderaadt return ((char *)s);
43125da6d1Sderaadt s++;
44125da6d1Sderaadt }
45125da6d1Sderaadt return (NULL);
46125da6d1Sderaadt }
47