import less(1)
[unleashed/tickless.git] / usr / src / lib / libc / port / stdio / wscanf.c
bloba1c0873bce8429bff626df68aa630552851b55e8
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #pragma ident "%Z%%M% %I% %E% SMI"
29 #include "lint.h"
30 #include "file64.h"
31 #include <mtlib.h>
32 #include <stdio.h>
33 #include <stdarg.h>
34 #include <string.h>
35 #include <thread.h>
36 #include <synch.h>
37 #include <wchar.h>
38 #include <errno.h>
39 #include <stdlib.h>
40 #include <alloca.h>
41 #include "mse.h"
42 #include "stdiom.h"
43 #include "libc.h"
45 int
46 wscanf(const wchar_t *fmt, ...)
48 int ret;
49 va_list ap;
51 va_start(ap, fmt);
52 ret = vwscanf(fmt, ap);
53 va_end(ap);
55 return (ret);
58 int
59 fwscanf(FILE *iop, const wchar_t *fmt, ...)
61 int ret;
62 va_list ap;
64 va_start(ap, fmt);
65 ret = vfwscanf(iop, fmt, ap);
66 va_end(ap);
68 return (ret);
71 int
72 swscanf(const wchar_t *wstr, const wchar_t *fmt, ...)
74 int ret;
75 va_list ap;
77 va_start(ap, fmt);
78 ret = vswscanf(wstr, fmt, ap);
79 va_end(ap);
81 return (ret);
85 #ifndef _LP64
88 * 32-bit shadow function _wscanf_c89(), _fwscanf_c89(), _swscanf_c89()
89 * are included here.
90 * When using the c89 compiler to build 32-bit applications, the size
91 * of intmax_t is 32-bits, otherwise the size of intmax_t is 64-bits.
92 * The shadow function uses 32-bit size of intmax_t for %j conversion.
93 * The #pragma redefine_extname in <stdio.h> selects the proper routine
94 * at compile time for the user application.
95 * NOTE: the shadow function only exists in the 32-bit library.
98 int
99 _wscanf_c89(const wchar_t *fmt, ...)
101 int ret;
102 va_list ap;
104 va_start(ap, fmt);
105 ret = _vwscanf_c89(fmt, ap);
106 va_end(ap);
108 return (ret);
112 _fwscanf_c89(FILE *iop, const wchar_t *fmt, ...)
114 int ret;
115 va_list ap;
117 va_start(ap, fmt);
118 ret = _vfwscanf_c89(iop, fmt, ap);
119 va_end(ap);
121 return (ret);
125 _swscanf_c89(const wchar_t *wstr, const wchar_t *fmt, ...)
127 int ret;
128 va_list ap;
130 va_start(ap, fmt);
131 ret = _vswscanf_c89(wstr, fmt, ap);
132 va_end(ap);
134 return (ret);
136 #endif /* _LP64 */