194336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hughes/* $OpenBSD: wprintf.c,v 1.3 2011/04/28 17:38:46 stsp Exp $ */ 294336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hughes/*- 394336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hughes * Copyright (c) 1990, 1993 494336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hughes * The Regents of the University of California. All rights reserved. 594336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hughes * 694336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hughes * This code is derived from software contributed to Berkeley by 794336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hughes * Chris Torek. 894336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hughes * 994336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hughes * Redistribution and use in source and binary forms, with or without 1094336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hughes * modification, are permitted provided that the following conditions 1194336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hughes * are met: 1294336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hughes * 1. Redistributions of source code must retain the above copyright 1394336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hughes * notice, this list of conditions and the following disclaimer. 1494336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hughes * 2. Redistributions in binary form must reproduce the above copyright 1594336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hughes * notice, this list of conditions and the following disclaimer in the 1694336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hughes * documentation and/or other materials provided with the distribution. 1794336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hughes * 3. Neither the name of the University nor the names of its contributors 1894336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hughes * may be used to endorse or promote products derived from this software 1994336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hughes * without specific prior written permission. 2094336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hughes * 2194336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hughes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2294336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hughes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2394336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hughes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2494336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hughes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2594336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hughes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2694336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hughes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2794336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hughes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2894336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hughes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2994336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hughes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3094336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hughes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3194336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hughes * SUCH DAMAGE. 3294336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hughes */ 3394336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hughes 3494336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hughes#include <stdio.h> 3594336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hughes#include <stdarg.h> 3694336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hughes#include <wchar.h> 3794336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hughes 3894336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hughesint 3994336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hugheswprintf(const wchar_t * __restrict fmt, ...) 4094336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hughes{ 4194336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hughes int ret; 4294336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hughes va_list ap; 4394336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hughes 4494336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hughes va_start(ap, fmt); 4594336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hughes ret = vfwprintf(stdout, fmt, ap); 4694336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hughes va_end(ap); 4794336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hughes return (ret); 4894336d8ecf795cfdde874a1e15977d68cfc7afc1Elliott Hughes} 49