wmemchr.c revision 188080
1132720Skan/*-
2132720Skan * Copyright (c)1999 Citrus Project,
3169691Skan * All rights reserved.
4169691Skan *
5132720Skan * Redistribution and use in source and binary forms, with or without
6132720Skan * modification, are permitted provided that the following conditions
7132720Skan * are met:
8132720Skan * 1. Redistributions of source code must retain the above copyright
9132720Skan *    notice, this list of conditions and the following disclaimer.
10132720Skan * 2. Redistributions in binary form must reproduce the above copyright
11132720Skan *    notice, this list of conditions and the following disclaimer in the
12132720Skan *    documentation and/or other materials provided with the distribution.
13132720Skan *
14132720Skan * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15132720Skan * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16132720Skan * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17132720Skan * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18132720Skan * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19169691Skan * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20132720Skan * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21132720Skan * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22132720Skan * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23132720Skan * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24132720Skan * SUCH DAMAGE.
25132720Skan *
26132720Skan *	citrus Id: wmemchr.c,v 1.2 2000/12/20 14:08:31 itojun Exp
27132720Skan */
28132720Skan
29132720Skan#include <sys/cdefs.h>
30132720Skan#if 0
31132720Skan#if defined(LIBC_SCCS) && !defined(lint)
32132720Skan__RCSID("$NetBSD: wmemchr.c,v 1.1 2000/12/23 23:14:37 itojun Exp $");
33132720Skan#endif /* LIBC_SCCS and not lint */
34132720Skan#endif
35132720Skan__FBSDID("$FreeBSD: head/lib/libc/string/wmemchr.c 188080 2009-02-03 17:58:20Z danger $");
36132720Skan
37132720Skan#include <wchar.h>
38132720Skan
39132720Skanwchar_t	*
40132720Skanwmemchr(const wchar_t *s, wchar_t c, size_t n)
41132720Skan{
42132720Skan	size_t i;
43132720Skan
44132720Skan	for (i = 0; i < n; i++) {
45132720Skan		if (*s == c) {
46132720Skan			/* LINTED const castaway */
47132720Skan			return (wchar_t *)s;
48132720Skan		}
49132720Skan		s++;
50132720Skan	}
51132720Skan	return NULL;
52132720Skan}
53132720Skan