176612Stshiozak/*-
2105786Stjr * Copyright (c) 2002 Tim J. Robbins
376612Stshiozak * All rights reserved.
476612Stshiozak *
576612Stshiozak * Redistribution and use in source and binary forms, with or without
676612Stshiozak * modification, are permitted provided that the following conditions
776612Stshiozak * are met:
876612Stshiozak * 1. Redistributions of source code must retain the above copyright
976612Stshiozak *    notice, this list of conditions and the following disclaimer.
1076612Stshiozak * 2. Redistributions in binary form must reproduce the above copyright
1176612Stshiozak *    notice, this list of conditions and the following disclaimer in the
1276612Stshiozak *    documentation and/or other materials provided with the distribution.
1376612Stshiozak *
1476612Stshiozak * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1576612Stshiozak * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1676612Stshiozak * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1776612Stshiozak * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1876612Stshiozak * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1976612Stshiozak * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2076612Stshiozak * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2176612Stshiozak * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2276612Stshiozak * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2376612Stshiozak * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2476612Stshiozak * SUCH DAMAGE.
2576612Stshiozak */
2676612Stshiozak
2776612Stshiozak#include <sys/cdefs.h>
2886170Sobrien__FBSDID("$FreeBSD$");
2976612Stshiozak
3076612Stshiozak#include <wchar.h>
3176612Stshiozak
3276612Stshiozakwchar_t *
33105786Stjrwcsrchr(const wchar_t *s, wchar_t c)
3476612Stshiozak{
35105786Stjr	const wchar_t *last;
3676612Stshiozak
37105786Stjr	last = NULL;
38105786Stjr	for (;;) {
39105786Stjr		if (*s == c)
40105786Stjr			last = s;
41105786Stjr		if (*s == L'\0')
42105786Stjr			break;
43105786Stjr		s++;
4476612Stshiozak	}
45105786Stjr
46105786Stjr	return ((wchar_t *)last);
4776612Stshiozak}
48