10Sstevel@tonic-gate /*
20Sstevel@tonic-gate * CDDL HEADER START
30Sstevel@tonic-gate *
40Sstevel@tonic-gate * The contents of this file are subject to the terms of the
5*6812Sraf * Common Development and Distribution License (the "License").
6*6812Sraf * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate *
80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate * See the License for the specific language governing permissions
110Sstevel@tonic-gate * and limitations under the License.
120Sstevel@tonic-gate *
130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate *
190Sstevel@tonic-gate * CDDL HEADER END
200Sstevel@tonic-gate */
21*6812Sraf
220Sstevel@tonic-gate /*
23*6812Sraf * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
240Sstevel@tonic-gate * Use is subject to license terms.
250Sstevel@tonic-gate */
260Sstevel@tonic-gate
270Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI"
280Sstevel@tonic-gate
29*6812Sraf #include "lint.h"
300Sstevel@tonic-gate #include "file64.h"
310Sstevel@tonic-gate #include <mtlib.h>
320Sstevel@tonic-gate #include <stdio.h>
330Sstevel@tonic-gate #include <stdarg.h>
340Sstevel@tonic-gate #include <string.h>
350Sstevel@tonic-gate #include <thread.h>
360Sstevel@tonic-gate #include <synch.h>
370Sstevel@tonic-gate #include <wchar.h>
380Sstevel@tonic-gate #include <errno.h>
390Sstevel@tonic-gate #include <stdlib.h>
400Sstevel@tonic-gate #include <alloca.h>
410Sstevel@tonic-gate #include "mse.h"
420Sstevel@tonic-gate #include "stdiom.h"
430Sstevel@tonic-gate #include "libc.h"
440Sstevel@tonic-gate
450Sstevel@tonic-gate int
wscanf(const wchar_t * fmt,...)460Sstevel@tonic-gate wscanf(const wchar_t *fmt, ...)
470Sstevel@tonic-gate {
480Sstevel@tonic-gate int ret;
490Sstevel@tonic-gate va_list ap;
500Sstevel@tonic-gate
510Sstevel@tonic-gate va_start(ap, fmt);
520Sstevel@tonic-gate ret = vwscanf(fmt, ap);
530Sstevel@tonic-gate va_end(ap);
540Sstevel@tonic-gate
550Sstevel@tonic-gate return (ret);
560Sstevel@tonic-gate }
570Sstevel@tonic-gate
580Sstevel@tonic-gate int
fwscanf(FILE * iop,const wchar_t * fmt,...)590Sstevel@tonic-gate fwscanf(FILE *iop, const wchar_t *fmt, ...)
600Sstevel@tonic-gate {
610Sstevel@tonic-gate int ret;
620Sstevel@tonic-gate va_list ap;
630Sstevel@tonic-gate
640Sstevel@tonic-gate va_start(ap, fmt);
650Sstevel@tonic-gate ret = vfwscanf(iop, fmt, ap);
660Sstevel@tonic-gate va_end(ap);
670Sstevel@tonic-gate
680Sstevel@tonic-gate return (ret);
690Sstevel@tonic-gate }
700Sstevel@tonic-gate
710Sstevel@tonic-gate int
swscanf(const wchar_t * wstr,const wchar_t * fmt,...)720Sstevel@tonic-gate swscanf(const wchar_t *wstr, const wchar_t *fmt, ...)
730Sstevel@tonic-gate {
740Sstevel@tonic-gate int ret;
750Sstevel@tonic-gate va_list ap;
760Sstevel@tonic-gate
770Sstevel@tonic-gate va_start(ap, fmt);
780Sstevel@tonic-gate ret = vswscanf(wstr, fmt, ap);
790Sstevel@tonic-gate va_end(ap);
800Sstevel@tonic-gate
810Sstevel@tonic-gate return (ret);
820Sstevel@tonic-gate }
830Sstevel@tonic-gate
840Sstevel@tonic-gate
850Sstevel@tonic-gate #ifndef _LP64
860Sstevel@tonic-gate
870Sstevel@tonic-gate /*
880Sstevel@tonic-gate * 32-bit shadow function _wscanf_c89(), _fwscanf_c89(), _swscanf_c89()
890Sstevel@tonic-gate * are included here.
900Sstevel@tonic-gate * When using the c89 compiler to build 32-bit applications, the size
910Sstevel@tonic-gate * of intmax_t is 32-bits, otherwise the size of intmax_t is 64-bits.
920Sstevel@tonic-gate * The shadow function uses 32-bit size of intmax_t for %j conversion.
930Sstevel@tonic-gate * The #pragma redefine_extname in <stdio.h> selects the proper routine
940Sstevel@tonic-gate * at compile time for the user application.
950Sstevel@tonic-gate * NOTE: the shadow function only exists in the 32-bit library.
960Sstevel@tonic-gate */
970Sstevel@tonic-gate
980Sstevel@tonic-gate int
_wscanf_c89(const wchar_t * fmt,...)990Sstevel@tonic-gate _wscanf_c89(const wchar_t *fmt, ...)
1000Sstevel@tonic-gate {
1010Sstevel@tonic-gate int ret;
1020Sstevel@tonic-gate va_list ap;
1030Sstevel@tonic-gate
1040Sstevel@tonic-gate va_start(ap, fmt);
1050Sstevel@tonic-gate ret = _vwscanf_c89(fmt, ap);
1060Sstevel@tonic-gate va_end(ap);
1070Sstevel@tonic-gate
1080Sstevel@tonic-gate return (ret);
1090Sstevel@tonic-gate }
1100Sstevel@tonic-gate
1110Sstevel@tonic-gate int
_fwscanf_c89(FILE * iop,const wchar_t * fmt,...)1120Sstevel@tonic-gate _fwscanf_c89(FILE *iop, const wchar_t *fmt, ...)
1130Sstevel@tonic-gate {
1140Sstevel@tonic-gate int ret;
1150Sstevel@tonic-gate va_list ap;
1160Sstevel@tonic-gate
1170Sstevel@tonic-gate va_start(ap, fmt);
1180Sstevel@tonic-gate ret = _vfwscanf_c89(iop, fmt, ap);
1190Sstevel@tonic-gate va_end(ap);
1200Sstevel@tonic-gate
1210Sstevel@tonic-gate return (ret);
1220Sstevel@tonic-gate }
1230Sstevel@tonic-gate
1240Sstevel@tonic-gate int
_swscanf_c89(const wchar_t * wstr,const wchar_t * fmt,...)1250Sstevel@tonic-gate _swscanf_c89(const wchar_t *wstr, const wchar_t *fmt, ...)
1260Sstevel@tonic-gate {
1270Sstevel@tonic-gate int ret;
1280Sstevel@tonic-gate va_list ap;
1290Sstevel@tonic-gate
1300Sstevel@tonic-gate va_start(ap, fmt);
1310Sstevel@tonic-gate ret = _vswscanf_c89(wstr, fmt, ap);
1320Sstevel@tonic-gate va_end(ap);
1330Sstevel@tonic-gate
1340Sstevel@tonic-gate return (ret);
1350Sstevel@tonic-gate }
1360Sstevel@tonic-gate #endif /* _LP64 */
137