146632c18SEd Schouten /*- 246632c18SEd Schouten * Copyright (c) 1990, 1993 346632c18SEd Schouten * The Regents of the University of California. All rights reserved. 446632c18SEd Schouten * 546632c18SEd Schouten * Redistribution and use in source and binary forms, with or without 646632c18SEd Schouten * modification, are permitted provided that the following conditions 746632c18SEd Schouten * are met: 846632c18SEd Schouten * 1. Redistributions of source code must retain the above copyright 946632c18SEd Schouten * notice, this list of conditions and the following disclaimer. 1046632c18SEd Schouten * 2. Redistributions in binary form must reproduce the above copyright 1146632c18SEd Schouten * notice, this list of conditions and the following disclaimer in the 1246632c18SEd Schouten * documentation and/or other materials provided with the distribution. 1346632c18SEd Schouten * 4. Neither the name of the University nor the names of its contributors 1446632c18SEd Schouten * may be used to endorse or promote products derived from this software 1546632c18SEd Schouten * without specific prior written permission. 1646632c18SEd Schouten * 1746632c18SEd Schouten * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 1846632c18SEd Schouten * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1946632c18SEd Schouten * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2046632c18SEd Schouten * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2146632c18SEd Schouten * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2246632c18SEd Schouten * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2346632c18SEd Schouten * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2446632c18SEd Schouten * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2546632c18SEd Schouten * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2646632c18SEd Schouten * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2746632c18SEd Schouten * SUCH DAMAGE. 2846632c18SEd Schouten */ 2946632c18SEd Schouten 3046632c18SEd Schouten #if defined(LIBC_SCCS) && !defined(lint) 3146632c18SEd Schouten static char sccsid[] = "@(#)index.c 8.1 (Berkeley) 6/4/93"; 3246632c18SEd Schouten #endif /* LIBC_SCCS and not lint */ 33333fc21eSDavid E. O'Brien #include <sys/cdefs.h> 34333fc21eSDavid E. O'Brien __FBSDID("$FreeBSD$"); 35333fc21eSDavid E. O'Brien 3646632c18SEd Schouten #include <stddef.h> 3746632c18SEd Schouten #include <string.h> 3846632c18SEd Schouten 3946632c18SEd Schouten char * 4046632c18SEd Schouten strchr(const char *p, int ch) 4146632c18SEd Schouten { 4246632c18SEd Schouten char c; 4346632c18SEd Schouten 4446632c18SEd Schouten c = ch; 4546632c18SEd Schouten for (;; ++p) { 4646632c18SEd Schouten if (*p == c) 4746632c18SEd Schouten return ((char *)p); 4846632c18SEd Schouten if (*p == '\0') 4946632c18SEd Schouten return (NULL); 5046632c18SEd Schouten } 5146632c18SEd Schouten /* NOTREACHED */ 5246632c18SEd Schouten } 5346632c18SEd Schouten 54*19c262feSEd Schouten __weak_reference(strchr, index); 55