1 /* 2 * CDDL HEADER START 3 * 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. 7 * 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. 12 * 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] 18 * 19 * CDDL HEADER END 20 */ 21 22 /* 23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #include "lint.h" 28 #include "file64.h" 29 #include <mtlib.h> 30 #include <stdio.h> 31 #include <stdarg.h> 32 #include <string.h> 33 #include <thread.h> 34 #include <synch.h> 35 #include <wchar.h> 36 #include <errno.h> 37 #include <stdlib.h> 38 #include <alloca.h> 39 #include "mse.h" 40 #include "stdiom.h" 41 #include "libc.h" 42 43 int 44 wscanf(const wchar_t *fmt, ...) 45 { 46 int ret; 47 va_list ap; 48 49 va_start(ap, fmt); 50 ret = vwscanf(fmt, ap); 51 va_end(ap); 52 53 return (ret); 54 } 55 56 int 57 fwscanf(FILE *iop, const wchar_t *fmt, ...) 58 { 59 int ret; 60 va_list ap; 61 62 va_start(ap, fmt); 63 ret = vfwscanf(iop, fmt, ap); 64 va_end(ap); 65 66 return (ret); 67 } 68 69 int 70 swscanf(const wchar_t *wstr, const wchar_t *fmt, ...) 71 { 72 int ret; 73 va_list ap; 74 75 va_start(ap, fmt); 76 ret = vswscanf(wstr, fmt, ap); 77 va_end(ap); 78 79 return (ret); 80 } 81 82 83 #ifndef _LP64 84 85 /* 86 * 32-bit shadow function _wscanf_c89(), _fwscanf_c89(), _swscanf_c89() 87 * are included here. 88 * When using the c89 compiler to build 32-bit applications, the size 89 * of intmax_t is 32-bits, otherwise the size of intmax_t is 64-bits. 90 * The shadow function uses 32-bit size of intmax_t for %j conversion. 91 * The #pragma redefine_extname in <stdio.h> selects the proper routine 92 * at compile time for the user application. 93 * NOTE: the shadow function only exists in the 32-bit library. 94 */ 95 96 int 97 _wscanf_c89(const wchar_t *fmt, ...) 98 { 99 int ret; 100 va_list ap; 101 102 va_start(ap, fmt); 103 ret = _vwscanf_c89(fmt, ap); 104 va_end(ap); 105 106 return (ret); 107 } 108 109 int 110 _fwscanf_c89(FILE *iop, const wchar_t *fmt, ...) 111 { 112 int ret; 113 va_list ap; 114 115 va_start(ap, fmt); 116 ret = _vfwscanf_c89(iop, fmt, ap); 117 va_end(ap); 118 119 return (ret); 120 } 121 122 int 123 _swscanf_c89(const wchar_t *wstr, const wchar_t *fmt, ...) 124 { 125 int ret; 126 va_list ap; 127 128 va_start(ap, fmt); 129 ret = _vswscanf_c89(wstr, fmt, ap); 130 va_end(ap); 131 132 return (ret); 133 } 134 #endif /* _LP64 */ 135