11.3Sjoerg/*	$NetBSD: fwscanf.c,v 1.3 2013/04/19 23:32:17 joerg Exp $	*/
21.1Schristos
31.1Schristos/*-
41.1Schristos * Copyright (c) 2002 Tim J. Robbins
51.1Schristos * All rights reserved.
61.1Schristos *
71.1Schristos * Redistribution and use in source and binary forms, with or without
81.1Schristos * modification, are permitted provided that the following conditions
91.1Schristos * are met:
101.1Schristos * 1. Redistributions of source code must retain the above copyright
111.1Schristos *    notice, this list of conditions and the following disclaimer.
121.1Schristos * 2. Redistributions in binary form must reproduce the above copyright
131.1Schristos *    notice, this list of conditions and the following disclaimer in the
141.1Schristos *    documentation and/or other materials provided with the distribution.
151.1Schristos *
161.1Schristos * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
171.1Schristos * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
181.1Schristos * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
191.1Schristos * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
201.1Schristos * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
211.1Schristos * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
221.1Schristos * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
231.1Schristos * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
241.1Schristos * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
251.1Schristos * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
261.1Schristos * SUCH DAMAGE.
271.1Schristos */
281.1Schristos
291.1Schristos#include <sys/cdefs.h>
301.1Schristos#if defined(LIBC_SCCS) && !defined(lint)
311.1Schristos#if 0
321.1Schristos__FBSDID("$FreeBSD: src/lib/libc/stdio/fwscanf.c,v 1.1 2002/09/23 12:40:06 tjr Exp $");
331.1Schristos#else
341.3Sjoerg__RCSID("$NetBSD: fwscanf.c,v 1.3 2013/04/19 23:32:17 joerg Exp $");
351.1Schristos#endif
361.1Schristos#endif /* LIBC_SCCS and not lint */
371.1Schristos
381.3Sjoerg#include "namespace.h"
391.3Sjoerg
401.1Schristos#include <stdarg.h>
411.1Schristos#include <stdio.h>
421.1Schristos#include <wchar.h>
431.1Schristos
441.3Sjoerg__weak_alias(fwscanf_l, _fwscanf_l)
451.3Sjoerg
461.1Schristosint
471.1Schristosfwscanf(FILE * __restrict fp, const wchar_t * __restrict fmt, ...)
481.1Schristos{
491.1Schristos	va_list ap;
501.1Schristos	int r;
511.1Schristos
521.1Schristos	va_start(ap, fmt);
531.1Schristos	r = vfwscanf(fp, fmt, ap);
541.1Schristos	va_end(ap);
551.1Schristos
561.2Schristos	return r;
571.1Schristos}
581.3Sjoerg
591.3Sjoergint
601.3Sjoergfwscanf_l(FILE * __restrict fp, locale_t loc, const wchar_t * __restrict fmt,
611.3Sjoerg    ...)
621.3Sjoerg{
631.3Sjoerg	va_list ap;
641.3Sjoerg	int r;
651.3Sjoerg
661.3Sjoerg	va_start(ap, fmt);
671.3Sjoerg	r = vfwscanf_l(fp, loc, fmt, ap);
681.3Sjoerg	va_end(ap);
691.3Sjoerg
701.3Sjoerg	return r;
711.3Sjoerg}
72