162f08720SJoerg Sonnenberger /*-
2e0f95098SPeter Avalos * Copyright (c) 2002 Tim J. Robbins.
362f08720SJoerg Sonnenberger * All rights reserved.
462f08720SJoerg Sonnenberger *
5*0d5acd74SJohn Marino * Copyright (c) 2011 The FreeBSD Foundation
6*0d5acd74SJohn Marino * All rights reserved.
7*0d5acd74SJohn Marino * Portions of this software were developed by David Chisnall
8*0d5acd74SJohn Marino * under sponsorship from the FreeBSD Foundation.
9*0d5acd74SJohn Marino *
1062f08720SJoerg Sonnenberger * Redistribution and use in source and binary forms, with or without
1162f08720SJoerg Sonnenberger * modification, are permitted provided that the following conditions
1262f08720SJoerg Sonnenberger * are met:
1362f08720SJoerg Sonnenberger * 1. Redistributions of source code must retain the above copyright
1462f08720SJoerg Sonnenberger * notice, this list of conditions and the following disclaimer.
1562f08720SJoerg Sonnenberger * 2. Redistributions in binary form must reproduce the above copyright
1662f08720SJoerg Sonnenberger * notice, this list of conditions and the following disclaimer in the
1762f08720SJoerg Sonnenberger * documentation and/or other materials provided with the distribution.
1862f08720SJoerg Sonnenberger *
1962f08720SJoerg Sonnenberger * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
2062f08720SJoerg Sonnenberger * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2162f08720SJoerg Sonnenberger * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2262f08720SJoerg Sonnenberger * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2362f08720SJoerg Sonnenberger * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2462f08720SJoerg Sonnenberger * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2562f08720SJoerg Sonnenberger * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2662f08720SJoerg Sonnenberger * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2762f08720SJoerg Sonnenberger * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2862f08720SJoerg Sonnenberger * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2962f08720SJoerg Sonnenberger * SUCH DAMAGE.
3062f08720SJoerg Sonnenberger *
31*0d5acd74SJohn Marino * $FreeBSD: head/lib/libc/stdio/putwc.c 227753 2011-11-20 14:45:42Z theraven $
3262f08720SJoerg Sonnenberger */
3362f08720SJoerg Sonnenberger
34*0d5acd74SJohn Marino
35e0f95098SPeter Avalos #include "namespace.h"
3662f08720SJoerg Sonnenberger #include <stdio.h>
3762f08720SJoerg Sonnenberger #include <wchar.h>
38e0f95098SPeter Avalos #include "un-namespace.h"
39e0f95098SPeter Avalos #include "libc_private.h"
40e0f95098SPeter Avalos #include "local.h"
41*0d5acd74SJohn Marino #include "xlocale_private.h"
4262f08720SJoerg Sonnenberger
4362f08720SJoerg Sonnenberger #undef putwc
4462f08720SJoerg Sonnenberger
45e0f95098SPeter Avalos /*
46e0f95098SPeter Avalos * Synonym for fputwc(). The only difference is that putwc(), if it is a
47e0f95098SPeter Avalos * macro, may evaluate `fp' more than once.
48e0f95098SPeter Avalos */
4962f08720SJoerg Sonnenberger wint_t
putwc_l(wchar_t wc,FILE * fp,locale_t locale)50*0d5acd74SJohn Marino putwc_l(wchar_t wc, FILE *fp, locale_t locale)
51*0d5acd74SJohn Marino {
52*0d5acd74SJohn Marino FIX_LOCALE(locale);
53*0d5acd74SJohn Marino return (fputwc_l(wc, fp, locale));
54*0d5acd74SJohn Marino }
55*0d5acd74SJohn Marino wint_t
putwc(wchar_t wc,FILE * fp)5662f08720SJoerg Sonnenberger putwc(wchar_t wc, FILE *fp)
5762f08720SJoerg Sonnenberger {
58*0d5acd74SJohn Marino return putwc_l(wc, fp, __get_locale());
5962f08720SJoerg Sonnenberger }
60