putwchar.c revision 330897
1329222Shselasky/*-
2329222Shselasky * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3329222Shselasky *
4329222Shselasky * Copyright (c) 2002 Tim J. Robbins.
5329222Shselasky * All rights reserved.
6329222Shselasky *
7329222Shselasky * Copyright (c) 2011 The FreeBSD Foundation
8329222Shselasky * All rights reserved.
9329222Shselasky * Portions of this software were developed by David Chisnall
10329222Shselasky * under sponsorship from the FreeBSD Foundation.
11329222Shselasky *
12329222Shselasky * Redistribution and use in source and binary forms, with or without
13329222Shselasky * modification, are permitted provided that the following conditions
14329222Shselasky * are met:
15329222Shselasky * 1. Redistributions of source code must retain the above copyright
16329222Shselasky *    notice, this list of conditions and the following disclaimer.
17329222Shselasky * 2. Redistributions in binary form must reproduce the above copyright
18329222Shselasky *    notice, this list of conditions and the following disclaimer in the
19329222Shselasky *    documentation and/or other materials provided with the distribution.
20329222Shselasky *
21329222Shselasky * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
22329222Shselasky * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23329222Shselasky * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24329222Shselasky * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
25329222Shselasky * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26329222Shselasky * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27329222Shselasky * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28329222Shselasky * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29329222Shselasky * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30329222Shselasky * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31329222Shselasky * SUCH DAMAGE.
32329222Shselasky */
33329222Shselasky
34329222Shselasky#include <sys/cdefs.h>
35329222Shselasky__FBSDID("$FreeBSD: stable/11/lib/libc/stdio/putwchar.c 330897 2018-03-14 03:19:51Z eadler $");
36329222Shselasky
37329222Shselasky#include "namespace.h"
38329222Shselasky#include <stdio.h>
39329222Shselasky#include <wchar.h>
40329222Shselasky#include "un-namespace.h"
41329222Shselasky#include "libc_private.h"
42329222Shselasky#include "local.h"
43329222Shselasky#include "xlocale_private.h"
44329222Shselasky
45329222Shselasky#undef putwchar
46329222Shselasky
47329222Shselasky/*
48329222Shselasky * Synonym for fputwc(wc, stdout).
49329222Shselasky */
50329222Shselaskywint_t
51329222Shselaskyputwchar_l(wchar_t wc, locale_t locale)
52329222Shselasky{
53329222Shselasky	FIX_LOCALE(locale);
54329222Shselasky	return (fputwc_l(wc, stdout, locale));
55329222Shselasky}
56329222Shselaskywint_t
57329222Shselaskyputwchar(wchar_t wc)
58329222Shselasky{
59329222Shselasky	return putwchar_l(wc, __get_locale());
60329222Shselasky}
61329222Shselasky