1103739Stjr/*-
2103739Stjr * Copyright (c) 2002 Tim J. Robbins
3103739Stjr * All rights reserved.
4103739Stjr *
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 *
10103739Stjr * Redistribution and use in source and binary forms, with or without
11103739Stjr * modification, are permitted provided that the following conditions
12103739Stjr * are met:
13103739Stjr * 1. Redistributions of source code must retain the above copyright
14103739Stjr *    notice, this list of conditions and the following disclaimer.
15103739Stjr * 2. Redistributions in binary form must reproduce the above copyright
16103739Stjr *    notice, this list of conditions and the following disclaimer in the
17103739Stjr *    documentation and/or other materials provided with the distribution.
18103739Stjr *
19103739Stjr * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20103739Stjr * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21103739Stjr * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22103739Stjr * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
23103739Stjr * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24103739Stjr * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25103739Stjr * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26103739Stjr * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27103739Stjr * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28103739Stjr * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29103739Stjr * SUCH DAMAGE.
30103739Stjr */
31103739Stjr
32103739Stjr#include <sys/cdefs.h>
33103739Stjr__FBSDID("$FreeBSD$");
34103739Stjr
35103739Stjr#include <stdarg.h>
36103739Stjr#include <stdio.h>
37103739Stjr#include <wchar.h>
38227753Stheraven#include <xlocale.h>
39103739Stjr
40103739Stjrint
41103739Stjrswprintf(wchar_t * __restrict s, size_t n, const wchar_t * __restrict fmt, ...)
42103739Stjr{
43103739Stjr	int ret;
44103739Stjr	va_list ap;
45103739Stjr
46103739Stjr	va_start(ap, fmt);
47103739Stjr	ret = vswprintf(s, n, fmt, ap);
48103739Stjr	va_end(ap);
49103739Stjr
50103739Stjr	return (ret);
51103739Stjr}
52227753Stheravenint
53227753Stheravenswprintf_l(wchar_t * __restrict s, size_t n, locale_t locale,
54227753Stheraven		const wchar_t * __restrict fmt, ...)
55227753Stheraven{
56227753Stheraven	int ret;
57227753Stheraven	va_list ap;
58227753Stheraven
59227753Stheraven	va_start(ap, fmt);
60227753Stheraven	ret = vswprintf_l(s, n, locale, fmt, ap);
61227753Stheraven	va_end(ap);
62227753Stheraven
63227753Stheraven	return (ret);
64227753Stheraven}
65