xref: /openbsd-src/lib/libc/stdio/swprintf.c (revision 9b9d2a55a62c8e82206c25f94fcc7f4e2765250e)
1*9b9d2a55Sguenther /*	$OpenBSD: swprintf.c,v 1.6 2015/08/31 02:53:57 guenther Exp $ */
225963022Sstsp /*	$NetBSD: swprintf.c,v 1.1 2005/05/14 23:51:02 christos Exp $	*/
325963022Sstsp 
425963022Sstsp /*-
525963022Sstsp  * Copyright (c) 2002 Tim J. Robbins
625963022Sstsp  * All rights reserved.
725963022Sstsp  *
825963022Sstsp  * Redistribution and use in source and binary forms, with or without
925963022Sstsp  * modification, are permitted provided that the following conditions
1025963022Sstsp  * are met:
1125963022Sstsp  * 1. Redistributions of source code must retain the above copyright
1225963022Sstsp  *    notice, this list of conditions and the following disclaimer.
1325963022Sstsp  * 2. Redistributions in binary form must reproduce the above copyright
1425963022Sstsp  *    notice, this list of conditions and the following disclaimer in the
1525963022Sstsp  *    documentation and/or other materials provided with the distribution.
1625963022Sstsp  *
1725963022Sstsp  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1825963022Sstsp  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1925963022Sstsp  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2025963022Sstsp  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2125963022Sstsp  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2225963022Sstsp  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2325963022Sstsp  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2425963022Sstsp  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2525963022Sstsp  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2625963022Sstsp  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2725963022Sstsp  * SUCH DAMAGE.
2825963022Sstsp  */
2925963022Sstsp 
3025963022Sstsp #include <stdarg.h>
3125963022Sstsp #include <stdio.h>
3225963022Sstsp #include <wchar.h>
3325963022Sstsp 
3425963022Sstsp int
swprintf(wchar_t * __restrict s,size_t n,const wchar_t * __restrict fmt,...)3525963022Sstsp swprintf(wchar_t * __restrict s, size_t n, const wchar_t * __restrict fmt, ...)
3625963022Sstsp {
3725963022Sstsp 	int ret;
3825963022Sstsp 	va_list ap;
3925963022Sstsp 
4025963022Sstsp 	va_start(ap, fmt);
4125963022Sstsp 	ret = vswprintf(s, n, fmt, ap);
4225963022Sstsp 	va_end(ap);
4325963022Sstsp 
4425963022Sstsp 	return (ret);
4525963022Sstsp }
46*9b9d2a55Sguenther DEF_STRONG(swprintf);
47