153246Sarchie/*-
253246Sarchie * Copyright (c) 1990, 1993
3139823Simp *	The Regents of the University of California.  All rights reserved.
4139823Simp *
5139823Simp * This code is derived from software contributed to Berkeley by
653246Sarchie * Chris Torek.
753246Sarchie *
853246Sarchie * Copyright (c) 2011 The FreeBSD Foundation
953246Sarchie * All rights reserved.
1053246Sarchie * Portions of this software were developed by David Chisnall
1153246Sarchie * under sponsorship from the FreeBSD Foundation.
1253246Sarchie *
1353246Sarchie * Redistribution and use in source and binary forms, with or without
1453246Sarchie * modification, are permitted provided that the following conditions
1553246Sarchie * are met:
1653246Sarchie * 1. Redistributions of source code must retain the above copyright
1753246Sarchie *    notice, this list of conditions and the following disclaimer.
1853246Sarchie * 2. Redistributions in binary form must reproduce the above copyright
1953246Sarchie *    notice, this list of conditions and the following disclaimer in the
2053246Sarchie *    documentation and/or other materials provided with the distribution.
2153246Sarchie * 3. Neither the name of the University nor the names of its contributors
2253246Sarchie *    may be used to endorse or promote products derived from this software
2353246Sarchie *    without specific prior written permission.
2453246Sarchie *
2553246Sarchie * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2653246Sarchie * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2753246Sarchie * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2853246Sarchie * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2953246Sarchie * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3053246Sarchie * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3153246Sarchie * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3253246Sarchie * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3353246Sarchie * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3453246Sarchie * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3553246Sarchie * SUCH DAMAGE.
3653246Sarchie */
3753246Sarchie
3867506Sjulian#if defined(LIBC_SCCS) && !defined(lint)
3953246Sarchiestatic char sccsid[] = "@(#)fprintf.c	8.1 (Berkeley) 6/4/93";
4053246Sarchie#endif /* LIBC_SCCS and not lint */
4153246Sarchie#include <sys/cdefs.h>
4253246Sarchie__FBSDID("$FreeBSD$");
4353246Sarchie
4453246Sarchie#include <stdio.h>
4553246Sarchie#include <stdarg.h>
4653246Sarchie#include "xlocale_private.h"
4753246Sarchie
4853246Sarchieint
4953246Sarchiefprintf(FILE * __restrict fp, const char * __restrict fmt, ...)
5053246Sarchie{
5153246Sarchie	int ret;
5253246Sarchie	va_list ap;
5353246Sarchie
5453246Sarchie	va_start(ap, fmt);
5553913Sarchie	ret = vfprintf_l(fp, __get_locale(), fmt, ap);
5653246Sarchie	va_end(ap);
5753246Sarchie	return (ret);
5853246Sarchie}
5953246Sarchieint
6053246Sarchiefprintf_l(FILE * __restrict fp, locale_t locale, const char * __restrict fmt, ...)
6153913Sarchie{
6253246Sarchie	int ret;
6353246Sarchie	va_list ap;
6453246Sarchie	FIX_LOCALE(locale);
6553913Sarchie
6653246Sarchie	va_start(ap, fmt);
6753246Sarchie	ret = vfprintf_l(fp, locale, fmt, ap);
6853246Sarchie	va_end(ap);
6953246Sarchie	return (ret);
7053246Sarchie}
7170870Sjulian