1102050Stjr/*-
2128004Stjr * Copyright (c) 2002-2004 Tim J. Robbins.
3102050Stjr * All rights reserved.
4102050Stjr *
5227753Stheraven * Copyright (c) 2011 The FreeBSD Foundation
6227753Stheraven * All rights reserved.
7227753Stheraven * Portions of this software were developed by David Chisnall
8227753Stheraven * under sponsorship from the FreeBSD Foundation.
9227753Stheraven *
10102050Stjr * Redistribution and use in source and binary forms, with or without
11102050Stjr * modification, are permitted provided that the following conditions
12102050Stjr * are met:
13102050Stjr * 1. Redistributions of source code must retain the above copyright
14102050Stjr *    notice, this list of conditions and the following disclaimer.
15102050Stjr * 2. Redistributions in binary form must reproduce the above copyright
16102050Stjr *    notice, this list of conditions and the following disclaimer in the
17102050Stjr *    documentation and/or other materials provided with the distribution.
18102050Stjr *
19102050Stjr * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20102050Stjr * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21102050Stjr * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22102050Stjr * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
23102050Stjr * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24102050Stjr * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25102050Stjr * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26102050Stjr * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27102050Stjr * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28102050Stjr * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29102050Stjr * SUCH DAMAGE.
30102050Stjr */
31102050Stjr
32102050Stjr#include <sys/cdefs.h>
33102050Stjr__FBSDID("$FreeBSD$");
34102050Stjr
35102050Stjr#include <wchar.h>
36129153Stjr#include "mblocal.h"
37102050Stjr
38102050Stjrint
39227753Stheravenmbsinit_l(const mbstate_t *ps, locale_t locale)
40227753Stheraven{
41227753Stheraven	FIX_LOCALE(locale);
42227753Stheraven	return (XLOCALE_CTYPE(locale)->__mbsinit(ps));
43227753Stheraven}
44227753Stheravenint
45128004Stjrmbsinit(const mbstate_t *ps)
46102050Stjr{
47227753Stheraven	return mbsinit_l(ps, __get_locale());
48102050Stjr}
49