xref: /freebsd/lib/libc/stdio/wscanf.c (revision 1f4ff8506a801b76186abcb5690294b81ca2b754)
11f4ff850STim J. Robbins /*-
21f4ff850STim J. Robbins  * Copyright (c) 2002 Tim J. Robbins
31f4ff850STim J. Robbins  * All rights reserved.
41f4ff850STim J. Robbins  *
51f4ff850STim J. Robbins  * Redistribution and use in source and binary forms, with or without
61f4ff850STim J. Robbins  * modification, are permitted provided that the following conditions
71f4ff850STim J. Robbins  * are met:
81f4ff850STim J. Robbins  * 1. Redistributions of source code must retain the above copyright
91f4ff850STim J. Robbins  *    notice, this list of conditions and the following disclaimer.
101f4ff850STim J. Robbins  * 2. Redistributions in binary form must reproduce the above copyright
111f4ff850STim J. Robbins  *    notice, this list of conditions and the following disclaimer in the
121f4ff850STim J. Robbins  *    documentation and/or other materials provided with the distribution.
131f4ff850STim J. Robbins  *
141f4ff850STim J. Robbins  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
151f4ff850STim J. Robbins  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
161f4ff850STim J. Robbins  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
171f4ff850STim J. Robbins  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
181f4ff850STim J. Robbins  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
191f4ff850STim J. Robbins  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
201f4ff850STim J. Robbins  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
211f4ff850STim J. Robbins  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
221f4ff850STim J. Robbins  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
231f4ff850STim J. Robbins  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
241f4ff850STim J. Robbins  * SUCH DAMAGE.
251f4ff850STim J. Robbins  */
261f4ff850STim J. Robbins 
271f4ff850STim J. Robbins #include <sys/cdefs.h>
281f4ff850STim J. Robbins __FBSDID("$FreeBSD$");
291f4ff850STim J. Robbins 
301f4ff850STim J. Robbins #include <stdarg.h>
311f4ff850STim J. Robbins #include <stdio.h>
321f4ff850STim J. Robbins #include <wchar.h>
331f4ff850STim J. Robbins 
341f4ff850STim J. Robbins int
351f4ff850STim J. Robbins wscanf(const wchar_t * __restrict fmt, ...)
361f4ff850STim J. Robbins {
371f4ff850STim J. Robbins 	va_list ap;
381f4ff850STim J. Robbins 	int r;
391f4ff850STim J. Robbins 
401f4ff850STim J. Robbins 	va_start(ap, fmt);
411f4ff850STim J. Robbins 	r = vfwscanf(stdin, fmt, ap);
421f4ff850STim J. Robbins 	va_end(ap);
431f4ff850STim J. Robbins 
441f4ff850STim J. Robbins 	return (r);
451f4ff850STim J. Robbins }
46