116175Snate/*-
216175Snate * Copyright (c) 1990, 1993
316175Snate *	The Regents of the University of California.  All rights reserved.
416175Snate *
516175Snate * Redistribution and use in source and binary forms, with or without
616175Snate * modification, are permitted provided that the following conditions
716175Snate * are met:
816175Snate * 1. Redistributions of source code must retain the above copyright
916175Snate *    notice, this list of conditions and the following disclaimer.
1016175Snate * 2. Redistributions in binary form must reproduce the above copyright
1116175Snate *    notice, this list of conditions and the following disclaimer in the
1216175Snate *    documentation and/or other materials provided with the distribution.
1316175Snate * 4. Neither the name of the University nor the names of its contributors
1416175Snate *    may be used to endorse or promote products derived from this software
1516175Snate *    without specific prior written permission.
1616175Snate *
1716175Snate * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1816175Snate * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1916175Snate * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2016175Snate * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2116175Snate * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2216175Snate * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2316175Snate * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2416175Snate * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2516175Snate * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2616175Snate * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2716175Snate * SUCH DAMAGE.
2816175Snate */
2916175Snate
30116189Sobrien#include <sys/cdefs.h>
31116189Sobrien__FBSDID("$FreeBSD$");
32116189Sobrien
3353492Speter#include <sys/param.h>
3453492Speter#include <sys/libkern.h>
3516175Snate
3616175Snatechar *
37229366Sedstrchr(const char *p, int ch)
3816175Snate{
3954411Speter	union {
4054411Speter		const char *cp;
4154411Speter		char *p;
4254411Speter	} u;
4353492Speter
4454411Speter	u.cp = p;
4554411Speter	for (;; ++u.p) {
4654411Speter		if (*u.p == ch)
4754411Speter			return(u.p);
48127586Srobert		if (*u.p == '\0')
4953492Speter			return(NULL);
5053492Speter	}
5153492Speter	/* NOTREACHED */
5253492Speter}
53