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]
23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #pragma ident "%Z%%M% %I% %E% SMI"
46 #ifdef _C89_INTMAX32 /* _C89_INTMAX32 version in 32-bit libc only */
47 _vwscanf_c89(const wchar_t *fmt
, va_list ap
)
49 vwscanf(const wchar_t *fmt
, va_list ap
)
57 if (GET_NO_MODE(stdin
))
58 _setorientation(stdin
, _WC_MODE
);
61 ret
= __wdoscan_u(stdin
, fmt
, ap
, _F_INTMAX32
);
63 ret
= __wdoscan_u(stdin
, fmt
, ap
, 0);
70 #ifdef _C89_INTMAX32 /* _C89_INTMAX32 version in 32-bit libc only */
71 _vfwscanf_c89(FILE *iop
, const wchar_t *fmt
, va_list ap
)
73 vfwscanf(FILE *iop
, const wchar_t *fmt
, va_list ap
)
82 _setorientation(iop
, _WC_MODE
);
86 ret
= __wdoscan_u(iop
, fmt
, ap
, _F_INTMAX32
);
88 ret
= __wdoscan_u(iop
, fmt
, ap
, 0);
95 #ifdef _C89_INTMAX32 /* _C89_INTMAX32 version in 32-bit libc only */
96 _vswscanf_c89(const wchar_t *wstr
, const wchar_t *fmt
, va_list ap
)
98 vswscanf(const wchar_t *wstr
, const wchar_t *fmt
, va_list ap
)
107 * The dummy FILE * created for swscanf has the _IOWRT
108 * flag set to distinguish it from wscanf and fwscanf
112 clen
= wcstombs(NULL
, wstr
, 0);
113 if (clen
== (size_t)-1) {
117 tmp_buf
= alloca(sizeof (char) * (clen
+ 1));
120 wlen
= wcstombs(tmp_buf
, wstr
, clen
+ 1);
121 if (wlen
== (size_t)-1) {
126 strbuf
._flag
= _IOREAD
| _IOWRT
;
127 strbuf
._ptr
= strbuf
._base
= (unsigned char *)tmp_buf
;
128 strbuf
._cnt
= strlen(tmp_buf
);
129 SET_FILE(&strbuf
, _NFILE
);
131 /* Probably the following is not required. */
132 /* _setorientation(&strbuf, _WC_MODE); */
135 ret
= __wdoscan_u(&strbuf
, fmt
, ap
, _F_INTMAX32
);
137 ret
= __wdoscan_u(&strbuf
, fmt
, ap
, 0);