Daniel Gudbjartsson | 42c74d6 | 2002-08-17 01:22:00 +0000 | [diff] [blame] | 1 | /* |
| 2 | * general implementation of scanf used by scanf, sscanf, fscanf, |
| 3 | * _cscanf, wscanf, swscanf and fwscanf |
| 4 | * |
| 5 | * Copyright 1996,1998 Marcus Meissner |
| 6 | * Copyright 1996 Jukka Iivonen |
| 7 | * Copyright 1997,2000 Uwe Bonnes |
| 8 | * Copyright 2000 Jon Griffiths |
| 9 | * Copyright 2002 Daniel Gudbjartsson |
| 10 | * |
| 11 | * This library is free software; you can redistribute it and/or |
| 12 | * modify it under the terms of the GNU Lesser General Public |
| 13 | * License as published by the Free Software Foundation; either |
| 14 | * version 2.1 of the License, or (at your option) any later version. |
| 15 | * |
| 16 | * This library is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 19 | * Lesser General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU Lesser General Public |
| 22 | * License along with this library; if not, write to the Free Software |
Jonathan Ernst | 360a3f9 | 2006-05-18 14:49:52 +0200 | [diff] [blame] | 23 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA |
Daniel Gudbjartsson | 42c74d6 | 2002-08-17 01:22:00 +0000 | [diff] [blame] | 24 | */ |
| 25 | |
Alexandre Julliard | e37c6e1 | 2003-09-05 23:08:26 +0000 | [diff] [blame] | 26 | #include <stdarg.h> |
Piotr Caban | 17f486b | 2010-04-22 17:55:27 +0200 | [diff] [blame] | 27 | #include <limits.h> |
Alexandre Julliard | e37c6e1 | 2003-09-05 23:08:26 +0000 | [diff] [blame] | 28 | |
| 29 | #include "windef.h" |
Daniel Gudbjartsson | 42c74d6 | 2002-08-17 01:22:00 +0000 | [diff] [blame] | 30 | #include "winbase.h" |
György 'Nog' Jeney | e022026 | 2002-10-15 02:20:07 +0000 | [diff] [blame] | 31 | #include "winternl.h" |
Daniel Gudbjartsson | 42c74d6 | 2002-08-17 01:22:00 +0000 | [diff] [blame] | 32 | #include "msvcrt.h" |
Daniel Gudbjartsson | 42c74d6 | 2002-08-17 01:22:00 +0000 | [diff] [blame] | 33 | #include "wine/debug.h" |
| 34 | |
| 35 | WINE_DEFAULT_DEBUG_CHANNEL(msvcrt); |
| 36 | |
Alexandre Julliard | c042e13 | 2004-02-19 01:13:12 +0000 | [diff] [blame] | 37 | extern MSVCRT_FILE MSVCRT__iob[]; |
| 38 | |
Daniel Gudbjartsson | 42c74d6 | 2002-08-17 01:22:00 +0000 | [diff] [blame] | 39 | /* helper function for *scanf. Returns the value of character c in the |
| 40 | * given base, or -1 if the given character is not a digit of the base. |
| 41 | */ |
| 42 | static int char2digit(char c, int base) { |
| 43 | if ((c>='0') && (c<='9') && (c<='0'+base-1)) return (c-'0'); |
| 44 | if (base<=10) return -1; |
| 45 | if ((c>='A') && (c<='Z') && (c<='A'+base-11)) return (c-'A'+10); |
| 46 | if ((c>='a') && (c<='z') && (c<='a'+base-11)) return (c-'a'+10); |
| 47 | return -1; |
| 48 | } |
| 49 | |
| 50 | /* helper function for *wscanf. Returns the value of character c in the |
| 51 | * given base, or -1 if the given character is not a digit of the base. |
| 52 | */ |
Alexandre Julliard | 5f31b32 | 2002-12-19 04:21:30 +0000 | [diff] [blame] | 53 | static int wchar2digit(MSVCRT_wchar_t c, int base) { |
Michael Stefaniuc | ec4936a | 2007-06-22 23:39:31 +0200 | [diff] [blame] | 54 | if ((c>='0') && (c<='9') && (c<='0'+base-1)) return (c-'0'); |
Daniel Gudbjartsson | 42c74d6 | 2002-08-17 01:22:00 +0000 | [diff] [blame] | 55 | if (base<=10) return -1; |
Michael Stefaniuc | ec4936a | 2007-06-22 23:39:31 +0200 | [diff] [blame] | 56 | if ((c>='A') && (c<='Z') && (c<='A'+base-11)) return (c-'A'+10); |
| 57 | if ((c>='a') && (c<='z') && (c<='a'+base-11)) return (c-'a'+10); |
Daniel Gudbjartsson | 42c74d6 | 2002-08-17 01:22:00 +0000 | [diff] [blame] | 58 | return -1; |
| 59 | } |
| 60 | |
Piotr Caban | 231fc11 | 2010-04-22 13:48:49 +0200 | [diff] [blame] | 61 | /* vfscanf_l */ |
Daniel Gudbjartsson | 42c74d6 | 2002-08-17 01:22:00 +0000 | [diff] [blame] | 62 | #undef WIDE_SCANF |
| 63 | #undef CONSOLE |
| 64 | #undef STRING |
Piotr Caban | 17f486b | 2010-04-22 17:55:27 +0200 | [diff] [blame] | 65 | #undef SECURE |
Daniel Gudbjartsson | 42c74d6 | 2002-08-17 01:22:00 +0000 | [diff] [blame] | 66 | #include "scanf.h" |
| 67 | |
Piotr Caban | 3b99441 | 2010-04-22 13:52:18 +0200 | [diff] [blame] | 68 | /* vfscanf_l */ |
Piotr Caban | b38fcab | 2010-04-22 13:51:41 +0200 | [diff] [blame] | 69 | #define SECURE 1 |
| 70 | #include "scanf.h" |
| 71 | |
Piotr Caban | 231fc11 | 2010-04-22 13:48:49 +0200 | [diff] [blame] | 72 | /* vfwscanf_l */ |
Daniel Gudbjartsson | 42c74d6 | 2002-08-17 01:22:00 +0000 | [diff] [blame] | 73 | #define WIDE_SCANF 1 |
| 74 | #undef CONSOLE |
| 75 | #undef STRING |
Piotr Caban | 17f486b | 2010-04-22 17:55:27 +0200 | [diff] [blame] | 76 | #undef SECURE |
Daniel Gudbjartsson | 42c74d6 | 2002-08-17 01:22:00 +0000 | [diff] [blame] | 77 | #include "scanf.h" |
| 78 | |
Piotr Caban | 3b99441 | 2010-04-22 13:52:18 +0200 | [diff] [blame] | 79 | /* vfwscanf_s_l */ |
| 80 | #define SECURE 1 |
| 81 | #include "scanf.h" |
| 82 | |
Piotr Caban | 231fc11 | 2010-04-22 13:48:49 +0200 | [diff] [blame] | 83 | /* vsscanf_l */ |
Daniel Gudbjartsson | 42c74d6 | 2002-08-17 01:22:00 +0000 | [diff] [blame] | 84 | #undef WIDE_SCANF |
| 85 | #undef CONSOLE |
| 86 | #define STRING 1 |
Piotr Caban | 17f486b | 2010-04-22 17:55:27 +0200 | [diff] [blame] | 87 | #undef SECURE |
Daniel Gudbjartsson | 42c74d6 | 2002-08-17 01:22:00 +0000 | [diff] [blame] | 88 | #include "scanf.h" |
| 89 | |
Piotr Caban | 8386e95 | 2010-04-22 13:52:55 +0200 | [diff] [blame] | 90 | /* vsscanf_s_l */ |
| 91 | #define SECURE 1 |
| 92 | #include "scanf.h" |
| 93 | |
Piotr Caban | 231fc11 | 2010-04-22 13:48:49 +0200 | [diff] [blame] | 94 | /* vswscanf_l */ |
Daniel Gudbjartsson | 42c74d6 | 2002-08-17 01:22:00 +0000 | [diff] [blame] | 95 | #define WIDE_SCANF 1 |
| 96 | #undef CONSOLE |
| 97 | #define STRING 1 |
Piotr Caban | 17f486b | 2010-04-22 17:55:27 +0200 | [diff] [blame] | 98 | #undef SECURE |
Daniel Gudbjartsson | 42c74d6 | 2002-08-17 01:22:00 +0000 | [diff] [blame] | 99 | #include "scanf.h" |
| 100 | |
Piotr Caban | a51292e | 2010-04-22 13:53:10 +0200 | [diff] [blame] | 101 | /* vswscanf_s_l */ |
| 102 | #define SECURE 1 |
| 103 | #include "scanf.h" |
| 104 | |
Piotr Caban | 231fc11 | 2010-04-22 13:48:49 +0200 | [diff] [blame] | 105 | /* vcscanf_l */ |
Daniel Gudbjartsson | 42c74d6 | 2002-08-17 01:22:00 +0000 | [diff] [blame] | 106 | #undef WIDE_SCANF |
| 107 | #define CONSOLE 1 |
| 108 | #undef STRING |
Piotr Caban | 17f486b | 2010-04-22 17:55:27 +0200 | [diff] [blame] | 109 | #undef SECURE |
Daniel Gudbjartsson | 42c74d6 | 2002-08-17 01:22:00 +0000 | [diff] [blame] | 110 | #include "scanf.h" |
Alexandre Julliard | c042e13 | 2004-02-19 01:13:12 +0000 | [diff] [blame] | 111 | |
Piotr Caban | 177d545 | 2010-04-22 13:53:28 +0200 | [diff] [blame] | 112 | /* vcscanf_s_l */ |
| 113 | #define SECURE 1 |
| 114 | #include "scanf.h" |
| 115 | |
Piotr Caban | f36671c | 2010-04-22 13:54:03 +0200 | [diff] [blame] | 116 | /* vcwscanf_l */ |
| 117 | #define WIDE_SCANF 1 |
| 118 | #define CONSOLE 1 |
| 119 | #undef STRING |
| 120 | #undef SECURE |
| 121 | #include "scanf.h" |
| 122 | |
| 123 | /* vcwscanf_s_l */ |
| 124 | #define SECURE 1 |
| 125 | #include "scanf.h" |
| 126 | |
Alexandre Julliard | c042e13 | 2004-02-19 01:13:12 +0000 | [diff] [blame] | 127 | |
| 128 | /********************************************************************* |
| 129 | * fscanf (MSVCRT.@) |
| 130 | */ |
Alexandre Julliard | 24beabf | 2006-06-13 11:21:19 +0200 | [diff] [blame] | 131 | int CDECL MSVCRT_fscanf(MSVCRT_FILE *file, const char *format, ...) |
Alexandre Julliard | c042e13 | 2004-02-19 01:13:12 +0000 | [diff] [blame] | 132 | { |
Alexandre Julliard | f8de2eb | 2009-01-02 21:44:40 +0100 | [diff] [blame] | 133 | __ms_va_list valist; |
Alexandre Julliard | c042e13 | 2004-02-19 01:13:12 +0000 | [diff] [blame] | 134 | int res; |
| 135 | |
Alexandre Julliard | f8de2eb | 2009-01-02 21:44:40 +0100 | [diff] [blame] | 136 | __ms_va_start(valist, format); |
Piotr Caban | 231fc11 | 2010-04-22 13:48:49 +0200 | [diff] [blame] | 137 | res = MSVCRT_vfscanf_l(file, format, NULL, valist); |
Alexandre Julliard | f8de2eb | 2009-01-02 21:44:40 +0100 | [diff] [blame] | 138 | __ms_va_end(valist); |
Alexandre Julliard | c042e13 | 2004-02-19 01:13:12 +0000 | [diff] [blame] | 139 | return res; |
| 140 | } |
| 141 | |
| 142 | /********************************************************************* |
Piotr Caban | 66042e0 | 2010-04-22 13:49:06 +0200 | [diff] [blame] | 143 | * _fscanf_l (MSVCRT.@) |
| 144 | */ |
| 145 | int CDECL MSVCRT__fscanf_l(MSVCRT_FILE *file, const char *format, |
| 146 | MSVCRT__locale_t locale, ...) |
| 147 | { |
| 148 | __ms_va_list valist; |
| 149 | int res; |
| 150 | |
| 151 | __ms_va_start(valist, locale); |
| 152 | res = MSVCRT_vfscanf_l(file, format, locale, valist); |
| 153 | __ms_va_end(valist); |
| 154 | return res; |
| 155 | } |
| 156 | |
| 157 | /********************************************************************* |
Piotr Caban | b38fcab | 2010-04-22 13:51:41 +0200 | [diff] [blame] | 158 | * fscanf_s (MSVCRT.@) |
| 159 | */ |
| 160 | int CDECL MSVCRT_fscanf_s(MSVCRT_FILE *file, const char *format, ...) |
| 161 | { |
| 162 | __ms_va_list valist; |
| 163 | int res; |
| 164 | |
| 165 | __ms_va_start(valist, format); |
| 166 | res = MSVCRT_vfscanf_s_l(file, format, NULL, valist); |
| 167 | __ms_va_end(valist); |
| 168 | return res; |
| 169 | } |
| 170 | |
| 171 | /********************************************************************* |
| 172 | * _fscanf_s_l (MSVCRT.@) |
| 173 | */ |
| 174 | int CDECL MSVCRT__fscanf_s_l(MSVCRT_FILE *file, const char *format, |
| 175 | MSVCRT__locale_t locale, ...) |
| 176 | { |
| 177 | __ms_va_list valist; |
| 178 | int res; |
| 179 | |
| 180 | __ms_va_start(valist, locale); |
| 181 | res = MSVCRT_vfscanf_s_l(file, format, locale, valist); |
| 182 | __ms_va_end(valist); |
| 183 | return res; |
| 184 | } |
| 185 | |
| 186 | /********************************************************************* |
Alexandre Julliard | c042e13 | 2004-02-19 01:13:12 +0000 | [diff] [blame] | 187 | * scanf (MSVCRT.@) |
| 188 | */ |
Alexandre Julliard | 24beabf | 2006-06-13 11:21:19 +0200 | [diff] [blame] | 189 | int CDECL MSVCRT_scanf(const char *format, ...) |
Alexandre Julliard | c042e13 | 2004-02-19 01:13:12 +0000 | [diff] [blame] | 190 | { |
Alexandre Julliard | f8de2eb | 2009-01-02 21:44:40 +0100 | [diff] [blame] | 191 | __ms_va_list valist; |
Alexandre Julliard | c042e13 | 2004-02-19 01:13:12 +0000 | [diff] [blame] | 192 | int res; |
| 193 | |
Alexandre Julliard | f8de2eb | 2009-01-02 21:44:40 +0100 | [diff] [blame] | 194 | __ms_va_start(valist, format); |
Piotr Caban | 231fc11 | 2010-04-22 13:48:49 +0200 | [diff] [blame] | 195 | res = MSVCRT_vfscanf_l(MSVCRT_stdin, format, NULL, valist); |
Alexandre Julliard | f8de2eb | 2009-01-02 21:44:40 +0100 | [diff] [blame] | 196 | __ms_va_end(valist); |
Alexandre Julliard | c042e13 | 2004-02-19 01:13:12 +0000 | [diff] [blame] | 197 | return res; |
| 198 | } |
| 199 | |
| 200 | /********************************************************************* |
Piotr Caban | 00f7045 | 2010-04-22 13:49:16 +0200 | [diff] [blame] | 201 | * _scanf_l (MSVCRT.@) |
| 202 | */ |
| 203 | int CDECL MSVCRT__scanf_l(const char *format, MSVCRT__locale_t locale, ...) |
| 204 | { |
| 205 | __ms_va_list valist; |
| 206 | int res; |
| 207 | |
| 208 | __ms_va_start(valist, locale); |
| 209 | res = MSVCRT_vfscanf_l(MSVCRT_stdin, format, locale, valist); |
| 210 | __ms_va_end(valist); |
| 211 | return res; |
| 212 | } |
| 213 | |
| 214 | /********************************************************************* |
Piotr Caban | 2c07fad | 2010-04-22 13:51:57 +0200 | [diff] [blame] | 215 | * scanf_s (MSVCRT.@) |
| 216 | */ |
| 217 | int CDECL MSVCRT_scanf_s(const char *format, ...) |
| 218 | { |
| 219 | __ms_va_list valist; |
| 220 | int res; |
| 221 | |
| 222 | __ms_va_start(valist, format); |
| 223 | res = MSVCRT_vfscanf_s_l(MSVCRT_stdin, format, NULL, valist); |
| 224 | __ms_va_end(valist); |
| 225 | return res; |
| 226 | } |
| 227 | |
| 228 | /********************************************************************* |
| 229 | * _scanf_s_l (MSVCRT.@) |
| 230 | */ |
| 231 | int CDECL MSVCRT__scanf_s_l(const char *format, MSVCRT__locale_t locale, ...) |
| 232 | { |
| 233 | __ms_va_list valist; |
| 234 | int res; |
| 235 | |
| 236 | __ms_va_start(valist, locale); |
| 237 | res = MSVCRT_vfscanf_s_l(MSVCRT_stdin, format, locale, valist); |
| 238 | __ms_va_end(valist); |
| 239 | return res; |
| 240 | } |
| 241 | |
| 242 | /********************************************************************* |
Alexandre Julliard | c042e13 | 2004-02-19 01:13:12 +0000 | [diff] [blame] | 243 | * fwscanf (MSVCRT.@) |
| 244 | */ |
Alexandre Julliard | 24beabf | 2006-06-13 11:21:19 +0200 | [diff] [blame] | 245 | int CDECL MSVCRT_fwscanf(MSVCRT_FILE *file, const MSVCRT_wchar_t *format, ...) |
Alexandre Julliard | c042e13 | 2004-02-19 01:13:12 +0000 | [diff] [blame] | 246 | { |
Alexandre Julliard | f8de2eb | 2009-01-02 21:44:40 +0100 | [diff] [blame] | 247 | __ms_va_list valist; |
Alexandre Julliard | c042e13 | 2004-02-19 01:13:12 +0000 | [diff] [blame] | 248 | int res; |
| 249 | |
Alexandre Julliard | f8de2eb | 2009-01-02 21:44:40 +0100 | [diff] [blame] | 250 | __ms_va_start(valist, format); |
Piotr Caban | 231fc11 | 2010-04-22 13:48:49 +0200 | [diff] [blame] | 251 | res = MSVCRT_vfwscanf_l(file, format, NULL, valist); |
Alexandre Julliard | f8de2eb | 2009-01-02 21:44:40 +0100 | [diff] [blame] | 252 | __ms_va_end(valist); |
Alexandre Julliard | c042e13 | 2004-02-19 01:13:12 +0000 | [diff] [blame] | 253 | return res; |
| 254 | } |
| 255 | |
Alexandre Julliard | c042e13 | 2004-02-19 01:13:12 +0000 | [diff] [blame] | 256 | /********************************************************************* |
Piotr Caban | 674df1e | 2010-04-22 13:49:35 +0200 | [diff] [blame] | 257 | * _fwscanf_l (MSVCRT.@) |
| 258 | */ |
| 259 | int CDECL MSVCRT__fwscanf_l(MSVCRT_FILE *file, const MSVCRT_wchar_t *format, |
| 260 | MSVCRT__locale_t locale, ...) |
| 261 | { |
| 262 | __ms_va_list valist; |
| 263 | int res; |
| 264 | |
| 265 | __ms_va_start(valist, locale); |
| 266 | res = MSVCRT_vfwscanf_l(file, format, locale, valist); |
| 267 | __ms_va_end(valist); |
| 268 | return res; |
| 269 | } |
| 270 | |
| 271 | /********************************************************************* |
Piotr Caban | 3b99441 | 2010-04-22 13:52:18 +0200 | [diff] [blame] | 272 | * fwscanf_s (MSVCRT.@) |
| 273 | */ |
| 274 | int CDECL MSVCRT_fwscanf_s(MSVCRT_FILE *file, const MSVCRT_wchar_t *format, ...) |
| 275 | { |
| 276 | __ms_va_list valist; |
| 277 | int res; |
| 278 | |
| 279 | __ms_va_start(valist, format); |
| 280 | res = MSVCRT_vfwscanf_s_l(file, format, NULL, valist); |
| 281 | __ms_va_end(valist); |
| 282 | return res; |
| 283 | } |
| 284 | |
| 285 | /********************************************************************* |
| 286 | * _fwscanf_s_l (MSVCRT.@) |
| 287 | */ |
| 288 | int CDECL MSVCRT__fwscanf_s_l(MSVCRT_FILE *file, const MSVCRT_wchar_t *format, |
| 289 | MSVCRT__locale_t locale, ...) |
| 290 | { |
| 291 | __ms_va_list valist; |
| 292 | int res; |
| 293 | |
| 294 | __ms_va_start(valist, locale); |
| 295 | res = MSVCRT_vfwscanf_s_l(file, format, locale, valist); |
| 296 | __ms_va_end(valist); |
| 297 | return res; |
| 298 | } |
| 299 | |
| 300 | /********************************************************************* |
Alexandre Julliard | c042e13 | 2004-02-19 01:13:12 +0000 | [diff] [blame] | 301 | * wscanf (MSVCRT.@) |
| 302 | */ |
Alexandre Julliard | 24beabf | 2006-06-13 11:21:19 +0200 | [diff] [blame] | 303 | int CDECL MSVCRT_wscanf(const MSVCRT_wchar_t *format, ...) |
Alexandre Julliard | c042e13 | 2004-02-19 01:13:12 +0000 | [diff] [blame] | 304 | { |
Alexandre Julliard | f8de2eb | 2009-01-02 21:44:40 +0100 | [diff] [blame] | 305 | __ms_va_list valist; |
Alexandre Julliard | c042e13 | 2004-02-19 01:13:12 +0000 | [diff] [blame] | 306 | int res; |
| 307 | |
Alexandre Julliard | f8de2eb | 2009-01-02 21:44:40 +0100 | [diff] [blame] | 308 | __ms_va_start(valist, format); |
Piotr Caban | 231fc11 | 2010-04-22 13:48:49 +0200 | [diff] [blame] | 309 | res = MSVCRT_vfwscanf_l(MSVCRT_stdin, format, NULL, valist); |
Alexandre Julliard | f8de2eb | 2009-01-02 21:44:40 +0100 | [diff] [blame] | 310 | __ms_va_end(valist); |
Alexandre Julliard | c042e13 | 2004-02-19 01:13:12 +0000 | [diff] [blame] | 311 | return res; |
| 312 | } |
| 313 | |
Piotr Caban | ced42a0 | 2010-04-22 13:49:58 +0200 | [diff] [blame] | 314 | /********************************************************************* |
| 315 | * _wscanf_l (MSVCRT.@) |
| 316 | */ |
| 317 | int CDECL MSVCRT__wscanf_l(const MSVCRT_wchar_t *format, |
| 318 | MSVCRT__locale_t locale, ...) |
| 319 | { |
| 320 | __ms_va_list valist; |
| 321 | int res; |
| 322 | |
| 323 | __ms_va_start(valist, locale); |
| 324 | res = MSVCRT_vfwscanf_l(MSVCRT_stdin, format, locale, valist); |
| 325 | __ms_va_end(valist); |
| 326 | return res; |
| 327 | } |
Alexandre Julliard | c042e13 | 2004-02-19 01:13:12 +0000 | [diff] [blame] | 328 | |
| 329 | /********************************************************************* |
Piotr Caban | 98e34c7 | 2010-04-22 13:52:33 +0200 | [diff] [blame] | 330 | * wscanf_s (MSVCRT.@) |
| 331 | */ |
| 332 | int CDECL MSVCRT_wscanf_s(const MSVCRT_wchar_t *format, ...) |
| 333 | { |
| 334 | __ms_va_list valist; |
| 335 | int res; |
| 336 | |
| 337 | __ms_va_start(valist, format); |
| 338 | res = MSVCRT_vfwscanf_s_l(MSVCRT_stdin, format, NULL, valist); |
| 339 | __ms_va_end(valist); |
| 340 | return res; |
| 341 | } |
| 342 | |
| 343 | /********************************************************************* |
| 344 | * _wscanf_s_l (MSVCRT.@) |
| 345 | */ |
| 346 | int CDECL MSVCRT__wscanf_s_l(const MSVCRT_wchar_t *format, |
| 347 | MSVCRT__locale_t locale, ...) |
| 348 | { |
| 349 | __ms_va_list valist; |
| 350 | int res; |
| 351 | |
| 352 | __ms_va_start(valist, locale); |
| 353 | res = MSVCRT_vfwscanf_s_l(MSVCRT_stdin, format, locale, valist); |
| 354 | __ms_va_end(valist); |
| 355 | return res; |
| 356 | } |
| 357 | |
| 358 | /********************************************************************* |
Alexandre Julliard | c042e13 | 2004-02-19 01:13:12 +0000 | [diff] [blame] | 359 | * sscanf (MSVCRT.@) |
| 360 | */ |
Alexandre Julliard | 24beabf | 2006-06-13 11:21:19 +0200 | [diff] [blame] | 361 | int CDECL MSVCRT_sscanf(const char *str, const char *format, ...) |
Alexandre Julliard | c042e13 | 2004-02-19 01:13:12 +0000 | [diff] [blame] | 362 | { |
Alexandre Julliard | f8de2eb | 2009-01-02 21:44:40 +0100 | [diff] [blame] | 363 | __ms_va_list valist; |
Alexandre Julliard | c042e13 | 2004-02-19 01:13:12 +0000 | [diff] [blame] | 364 | int res; |
| 365 | |
Alexandre Julliard | f8de2eb | 2009-01-02 21:44:40 +0100 | [diff] [blame] | 366 | __ms_va_start(valist, format); |
Piotr Caban | 231fc11 | 2010-04-22 13:48:49 +0200 | [diff] [blame] | 367 | res = MSVCRT_vsscanf_l(str, format, NULL, valist); |
Alexandre Julliard | f8de2eb | 2009-01-02 21:44:40 +0100 | [diff] [blame] | 368 | __ms_va_end(valist); |
Alexandre Julliard | c042e13 | 2004-02-19 01:13:12 +0000 | [diff] [blame] | 369 | return res; |
| 370 | } |
| 371 | |
Piotr Caban | edfe9bd | 2010-04-22 13:50:20 +0200 | [diff] [blame] | 372 | /********************************************************************* |
| 373 | * _sscanf_l (MSVCRT.@) |
| 374 | */ |
| 375 | int CDECL MSVCRT__sscanf_l(const char *str, const char *format, |
| 376 | MSVCRT__locale_t locale, ...) |
| 377 | { |
| 378 | __ms_va_list valist; |
| 379 | int res; |
| 380 | |
| 381 | __ms_va_start(valist, locale); |
| 382 | res = MSVCRT_vsscanf_l(str, format, locale, valist); |
| 383 | __ms_va_end(valist); |
| 384 | return res; |
| 385 | } |
Alexandre Julliard | c042e13 | 2004-02-19 01:13:12 +0000 | [diff] [blame] | 386 | |
| 387 | /********************************************************************* |
Piotr Caban | 8386e95 | 2010-04-22 13:52:55 +0200 | [diff] [blame] | 388 | * sscanf_s (MSVCRT.@) |
| 389 | */ |
| 390 | int CDECL MSVCRT_sscanf_s(const char *str, const char *format, ...) |
| 391 | { |
| 392 | __ms_va_list valist; |
| 393 | int res; |
| 394 | |
| 395 | __ms_va_start(valist, format); |
| 396 | res = MSVCRT_vsscanf_s_l(str, format, NULL, valist); |
| 397 | __ms_va_end(valist); |
| 398 | return res; |
| 399 | } |
| 400 | |
| 401 | /********************************************************************* |
| 402 | * _sscanf_s_l (MSVCRT.@) |
| 403 | */ |
| 404 | int CDECL MSVCRT__sscanf_s_l(const char *str, const char *format, |
| 405 | MSVCRT__locale_t locale, ...) |
| 406 | { |
| 407 | __ms_va_list valist; |
| 408 | int res; |
| 409 | |
| 410 | __ms_va_start(valist, locale); |
| 411 | res = MSVCRT_vsscanf_s_l(str, format, locale, valist); |
| 412 | __ms_va_end(valist); |
| 413 | return res; |
| 414 | } |
| 415 | |
| 416 | /********************************************************************* |
Alexandre Julliard | c042e13 | 2004-02-19 01:13:12 +0000 | [diff] [blame] | 417 | * swscanf (MSVCRT.@) |
| 418 | */ |
Alexandre Julliard | 24beabf | 2006-06-13 11:21:19 +0200 | [diff] [blame] | 419 | int CDECL MSVCRT_swscanf(const MSVCRT_wchar_t *str, const MSVCRT_wchar_t *format, ...) |
Alexandre Julliard | c042e13 | 2004-02-19 01:13:12 +0000 | [diff] [blame] | 420 | { |
Alexandre Julliard | f8de2eb | 2009-01-02 21:44:40 +0100 | [diff] [blame] | 421 | __ms_va_list valist; |
Alexandre Julliard | c042e13 | 2004-02-19 01:13:12 +0000 | [diff] [blame] | 422 | int res; |
| 423 | |
Alexandre Julliard | f8de2eb | 2009-01-02 21:44:40 +0100 | [diff] [blame] | 424 | __ms_va_start(valist, format); |
Piotr Caban | 231fc11 | 2010-04-22 13:48:49 +0200 | [diff] [blame] | 425 | res = MSVCRT_vswscanf_l(str, format, NULL, valist); |
Alexandre Julliard | f8de2eb | 2009-01-02 21:44:40 +0100 | [diff] [blame] | 426 | __ms_va_end(valist); |
Alexandre Julliard | c042e13 | 2004-02-19 01:13:12 +0000 | [diff] [blame] | 427 | return res; |
| 428 | } |
| 429 | |
Piotr Caban | 2242f28 | 2010-04-22 13:51:03 +0200 | [diff] [blame] | 430 | /********************************************************************* |
| 431 | * _swscanf_l (MSVCRT.@) |
| 432 | */ |
| 433 | int CDECL MSVCRT__swscanf_l(const MSVCRT_wchar_t *str, const MSVCRT_wchar_t *format, |
| 434 | MSVCRT__locale_t locale, ...) |
| 435 | { |
| 436 | __ms_va_list valist; |
| 437 | int res; |
| 438 | |
| 439 | __ms_va_start(valist, locale); |
| 440 | res = MSVCRT_vswscanf_l(str, format, locale, valist); |
| 441 | __ms_va_end(valist); |
| 442 | return res; |
| 443 | } |
Alexandre Julliard | c042e13 | 2004-02-19 01:13:12 +0000 | [diff] [blame] | 444 | |
| 445 | /********************************************************************* |
Piotr Caban | a51292e | 2010-04-22 13:53:10 +0200 | [diff] [blame] | 446 | * swscanf_s (MSVCRT.@) |
| 447 | */ |
| 448 | int CDECL MSVCRT_swscanf_s(const MSVCRT_wchar_t *str, const MSVCRT_wchar_t *format, ...) |
| 449 | { |
| 450 | __ms_va_list valist; |
| 451 | int res; |
| 452 | |
| 453 | __ms_va_start(valist, format); |
| 454 | res = MSVCRT_vswscanf_s_l(str, format, NULL, valist); |
| 455 | __ms_va_end(valist); |
| 456 | return res; |
| 457 | } |
| 458 | |
| 459 | /********************************************************************* |
| 460 | * _swscanf_s_l (MSVCRT.@) |
| 461 | */ |
| 462 | int CDECL MSVCRT__swscanf_s_l(const MSVCRT_wchar_t *str, const MSVCRT_wchar_t *format, |
| 463 | MSVCRT__locale_t locale, ...) |
| 464 | { |
| 465 | __ms_va_list valist; |
| 466 | int res; |
| 467 | |
| 468 | __ms_va_start(valist, locale); |
| 469 | res = MSVCRT_vswscanf_s_l(str, format, locale, valist); |
| 470 | __ms_va_end(valist); |
| 471 | return res; |
| 472 | } |
| 473 | |
| 474 | /********************************************************************* |
Alexandre Julliard | c042e13 | 2004-02-19 01:13:12 +0000 | [diff] [blame] | 475 | * _cscanf (MSVCRT.@) |
| 476 | */ |
Alexandre Julliard | 24beabf | 2006-06-13 11:21:19 +0200 | [diff] [blame] | 477 | int CDECL _cscanf(const char *format, ...) |
Alexandre Julliard | c042e13 | 2004-02-19 01:13:12 +0000 | [diff] [blame] | 478 | { |
Alexandre Julliard | f8de2eb | 2009-01-02 21:44:40 +0100 | [diff] [blame] | 479 | __ms_va_list valist; |
Alexandre Julliard | c042e13 | 2004-02-19 01:13:12 +0000 | [diff] [blame] | 480 | int res; |
| 481 | |
Alexandre Julliard | f8de2eb | 2009-01-02 21:44:40 +0100 | [diff] [blame] | 482 | __ms_va_start(valist, format); |
Piotr Caban | 231fc11 | 2010-04-22 13:48:49 +0200 | [diff] [blame] | 483 | res = MSVCRT_vcscanf_l(format, NULL, valist); |
Alexandre Julliard | f8de2eb | 2009-01-02 21:44:40 +0100 | [diff] [blame] | 484 | __ms_va_end(valist); |
Alexandre Julliard | c042e13 | 2004-02-19 01:13:12 +0000 | [diff] [blame] | 485 | return res; |
| 486 | } |
Piotr Caban | 8a69a93 | 2010-04-22 13:51:15 +0200 | [diff] [blame] | 487 | |
| 488 | /********************************************************************* |
| 489 | * _cscanf_l (MSVCRT.@) |
| 490 | */ |
| 491 | int CDECL _cscanf_l(const char *format, MSVCRT__locale_t locale, ...) |
| 492 | { |
| 493 | __ms_va_list valist; |
| 494 | int res; |
| 495 | |
| 496 | __ms_va_start(valist, locale); |
| 497 | res = MSVCRT_vcscanf_l(format, locale, valist); |
| 498 | __ms_va_end(valist); |
| 499 | return res; |
| 500 | } |
Piotr Caban | 177d545 | 2010-04-22 13:53:28 +0200 | [diff] [blame] | 501 | |
| 502 | /********************************************************************* |
| 503 | * _cscanf_s (MSVCRT.@) |
| 504 | */ |
| 505 | int CDECL _cscanf_s(const char *format, ...) |
| 506 | { |
| 507 | __ms_va_list valist; |
| 508 | int res; |
| 509 | |
| 510 | __ms_va_start(valist, format); |
| 511 | res = MSVCRT_vcscanf_s_l(format, NULL, valist); |
| 512 | __ms_va_end(valist); |
| 513 | return res; |
| 514 | } |
| 515 | |
| 516 | /********************************************************************* |
| 517 | * _cscanf_s_l (MSVCRT.@) |
| 518 | */ |
| 519 | int CDECL _cscanf_s_l(const char *format, MSVCRT__locale_t locale, ...) |
| 520 | { |
| 521 | __ms_va_list valist; |
| 522 | int res; |
| 523 | |
| 524 | __ms_va_start(valist, locale); |
| 525 | res = MSVCRT_vcscanf_s_l(format, locale, valist); |
| 526 | __ms_va_end(valist); |
| 527 | return res; |
| 528 | } |
Piotr Caban | f36671c | 2010-04-22 13:54:03 +0200 | [diff] [blame] | 529 | |
| 530 | /********************************************************************* |
| 531 | * _cwscanf (MSVCRT.@) |
| 532 | */ |
| 533 | int CDECL _cwscanf(const char *format, ...) |
| 534 | { |
| 535 | __ms_va_list valist; |
| 536 | int res; |
| 537 | |
| 538 | __ms_va_start(valist, format); |
| 539 | res = MSVCRT_vcwscanf_l(format, NULL, valist); |
| 540 | __ms_va_end(valist); |
| 541 | return res; |
| 542 | } |
| 543 | |
| 544 | /********************************************************************* |
| 545 | * _cwscanf_l (MSVCRT.@) |
| 546 | */ |
| 547 | int CDECL _cwscanf_l(const char *format, MSVCRT__locale_t locale, ...) |
| 548 | { |
| 549 | __ms_va_list valist; |
| 550 | int res; |
| 551 | |
| 552 | __ms_va_start(valist, locale); |
| 553 | res = MSVCRT_vcwscanf_l(format, locale, valist); |
| 554 | __ms_va_end(valist); |
| 555 | return res; |
| 556 | } |
| 557 | |
| 558 | /********************************************************************* |
| 559 | * _cwscanf_s (MSVCRT.@) |
| 560 | */ |
| 561 | int CDECL _cwscanf_s(const char *format, ...) |
| 562 | { |
| 563 | __ms_va_list valist; |
| 564 | int res; |
| 565 | |
| 566 | __ms_va_start(valist, format); |
| 567 | res = MSVCRT_vcwscanf_s_l(format, NULL, valist); |
| 568 | __ms_va_end(valist); |
| 569 | return res; |
| 570 | } |
| 571 | |
| 572 | /********************************************************************* |
| 573 | * _cwscanf_s_l (MSVCRT.@) |
| 574 | */ |
| 575 | int CDECL _cwscanf_s_l(const char *format, MSVCRT__locale_t locale, ...) |
| 576 | { |
| 577 | __ms_va_list valist; |
| 578 | int res; |
| 579 | |
| 580 | __ms_va_start(valist, locale); |
| 581 | res = MSVCRT_vcwscanf_s_l(format, locale, valist); |
| 582 | __ms_va_end(valist); |
| 583 | return res; |
| 584 | } |