2002-08-17 03:22:00 +02:00
|
|
|
/*
|
|
|
|
* general implementation of scanf used by scanf, sscanf, fscanf,
|
|
|
|
* _cscanf, wscanf, swscanf and fwscanf
|
|
|
|
*
|
|
|
|
* Copyright 1996,1998 Marcus Meissner
|
|
|
|
* Copyright 1996 Jukka Iivonen
|
|
|
|
* Copyright 1997,2000 Uwe Bonnes
|
|
|
|
* Copyright 2000 Jon Griffiths
|
|
|
|
* Copyright 2002 Daniel Gudbjartsson
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2002-08-17 03:22:00 +02:00
|
|
|
*/
|
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
2010-04-22 17:55:27 +02:00
|
|
|
#include <limits.h>
|
2012-11-01 15:27:29 +01:00
|
|
|
#include <math.h>
|
2003-09-06 01:08:26 +02:00
|
|
|
|
|
|
|
#include "windef.h"
|
2002-08-17 03:22:00 +02:00
|
|
|
#include "winbase.h"
|
2002-10-15 04:20:07 +02:00
|
|
|
#include "winternl.h"
|
2002-08-17 03:22:00 +02:00
|
|
|
#include "msvcrt.h"
|
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
|
|
|
|
|
2004-02-19 02:13:12 +01:00
|
|
|
extern MSVCRT_FILE MSVCRT__iob[];
|
|
|
|
|
2002-08-17 03:22:00 +02:00
|
|
|
/* helper function for *scanf. Returns the value of character c in the
|
|
|
|
* given base, or -1 if the given character is not a digit of the base.
|
|
|
|
*/
|
|
|
|
static int char2digit(char c, int base) {
|
|
|
|
if ((c>='0') && (c<='9') && (c<='0'+base-1)) return (c-'0');
|
|
|
|
if (base<=10) return -1;
|
|
|
|
if ((c>='A') && (c<='Z') && (c<='A'+base-11)) return (c-'A'+10);
|
|
|
|
if ((c>='a') && (c<='z') && (c<='a'+base-11)) return (c-'a'+10);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* helper function for *wscanf. Returns the value of character c in the
|
|
|
|
* given base, or -1 if the given character is not a digit of the base.
|
|
|
|
*/
|
2002-12-19 05:21:30 +01:00
|
|
|
static int wchar2digit(MSVCRT_wchar_t c, int base) {
|
2007-06-22 23:39:31 +02:00
|
|
|
if ((c>='0') && (c<='9') && (c<='0'+base-1)) return (c-'0');
|
2002-08-17 03:22:00 +02:00
|
|
|
if (base<=10) return -1;
|
2007-06-22 23:39:31 +02:00
|
|
|
if ((c>='A') && (c<='Z') && (c<='A'+base-11)) return (c-'A'+10);
|
|
|
|
if ((c>='a') && (c<='z') && (c<='a'+base-11)) return (c-'a'+10);
|
2002-08-17 03:22:00 +02:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2010-04-22 13:48:49 +02:00
|
|
|
/* vfscanf_l */
|
2002-08-17 03:22:00 +02:00
|
|
|
#undef WIDE_SCANF
|
|
|
|
#undef CONSOLE
|
|
|
|
#undef STRING
|
2010-04-22 17:55:27 +02:00
|
|
|
#undef SECURE
|
2002-08-17 03:22:00 +02:00
|
|
|
#include "scanf.h"
|
|
|
|
|
2016-08-24 13:58:31 +02:00
|
|
|
/* vfscanf_s_l */
|
2010-04-22 13:51:41 +02:00
|
|
|
#define SECURE 1
|
|
|
|
#include "scanf.h"
|
|
|
|
|
2010-04-22 13:48:49 +02:00
|
|
|
/* vfwscanf_l */
|
2002-08-17 03:22:00 +02:00
|
|
|
#define WIDE_SCANF 1
|
|
|
|
#undef CONSOLE
|
|
|
|
#undef STRING
|
2010-04-22 17:55:27 +02:00
|
|
|
#undef SECURE
|
2002-08-17 03:22:00 +02:00
|
|
|
#include "scanf.h"
|
|
|
|
|
2010-04-22 13:52:18 +02:00
|
|
|
/* vfwscanf_s_l */
|
|
|
|
#define SECURE 1
|
|
|
|
#include "scanf.h"
|
|
|
|
|
2010-04-22 13:48:49 +02:00
|
|
|
/* vsscanf_l */
|
2002-08-17 03:22:00 +02:00
|
|
|
#undef WIDE_SCANF
|
|
|
|
#undef CONSOLE
|
|
|
|
#define STRING 1
|
2010-04-22 17:55:27 +02:00
|
|
|
#undef SECURE
|
2002-08-17 03:22:00 +02:00
|
|
|
#include "scanf.h"
|
|
|
|
|
2010-04-22 13:52:55 +02:00
|
|
|
/* vsscanf_s_l */
|
|
|
|
#define SECURE 1
|
|
|
|
#include "scanf.h"
|
|
|
|
|
2011-04-05 17:06:58 +02:00
|
|
|
/* vsnscanf_l */
|
|
|
|
#undef SECURE
|
|
|
|
#define STRING_LEN 1
|
|
|
|
#include "scanf.h"
|
|
|
|
|
|
|
|
/* vsnscanf_s_l */
|
|
|
|
#define SECURE
|
|
|
|
#include "scanf.h"
|
2020-01-02 19:01:56 +01:00
|
|
|
#undef STRING_LEN
|
2011-04-05 17:07:17 +02:00
|
|
|
|
2020-01-02 19:01:56 +01:00
|
|
|
/* vswscanf_l */
|
2011-04-05 17:07:17 +02:00
|
|
|
#define WIDE_SCANF 1
|
2020-01-02 19:01:56 +01:00
|
|
|
#undef CONSOLE
|
|
|
|
#define STRING 1
|
2011-04-05 17:07:17 +02:00
|
|
|
#undef SECURE
|
|
|
|
#include "scanf.h"
|
|
|
|
|
2020-01-02 19:01:56 +01:00
|
|
|
/* vsnwscanf_l */
|
|
|
|
#define STRING_LEN 1
|
|
|
|
#include "scanf.h"
|
|
|
|
|
2011-04-05 17:07:17 +02:00
|
|
|
/* vsnwscanf_s_l */
|
|
|
|
#define SECURE 1
|
|
|
|
#include "scanf.h"
|
2011-04-05 17:06:58 +02:00
|
|
|
#undef STRING_LEN
|
|
|
|
|
2010-04-22 13:53:10 +02:00
|
|
|
/* vswscanf_s_l */
|
|
|
|
#define SECURE 1
|
|
|
|
#include "scanf.h"
|
|
|
|
|
2010-04-22 13:48:49 +02:00
|
|
|
/* vcscanf_l */
|
2002-08-17 03:22:00 +02:00
|
|
|
#undef WIDE_SCANF
|
|
|
|
#define CONSOLE 1
|
|
|
|
#undef STRING
|
2010-04-22 17:55:27 +02:00
|
|
|
#undef SECURE
|
2002-08-17 03:22:00 +02:00
|
|
|
#include "scanf.h"
|
2004-02-19 02:13:12 +01:00
|
|
|
|
2010-04-22 13:53:28 +02:00
|
|
|
/* vcscanf_s_l */
|
|
|
|
#define SECURE 1
|
|
|
|
#include "scanf.h"
|
|
|
|
|
2010-04-22 13:54:03 +02:00
|
|
|
/* vcwscanf_l */
|
|
|
|
#define WIDE_SCANF 1
|
|
|
|
#define CONSOLE 1
|
|
|
|
#undef STRING
|
|
|
|
#undef SECURE
|
|
|
|
#include "scanf.h"
|
|
|
|
|
|
|
|
/* vcwscanf_s_l */
|
|
|
|
#define SECURE 1
|
|
|
|
#include "scanf.h"
|
|
|
|
|
2004-02-19 02:13:12 +01:00
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* fscanf (MSVCRT.@)
|
|
|
|
*/
|
2017-11-02 10:19:18 +01:00
|
|
|
int WINAPIV MSVCRT_fscanf(MSVCRT_FILE *file, const char *format, ...)
|
2004-02-19 02:13:12 +01:00
|
|
|
{
|
2009-01-02 21:44:40 +01:00
|
|
|
__ms_va_list valist;
|
2004-02-19 02:13:12 +01:00
|
|
|
int res;
|
|
|
|
|
2009-01-02 21:44:40 +01:00
|
|
|
__ms_va_start(valist, format);
|
2010-04-22 13:48:49 +02:00
|
|
|
res = MSVCRT_vfscanf_l(file, format, NULL, valist);
|
2009-01-02 21:44:40 +01:00
|
|
|
__ms_va_end(valist);
|
2004-02-19 02:13:12 +01:00
|
|
|
return res;
|
2010-04-22 13:49:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* _fscanf_l (MSVCRT.@)
|
|
|
|
*/
|
2017-11-02 10:19:18 +01:00
|
|
|
int WINAPIV MSVCRT__fscanf_l(MSVCRT_FILE *file, const char *format,
|
2010-04-22 13:49:06 +02:00
|
|
|
MSVCRT__locale_t locale, ...)
|
|
|
|
{
|
|
|
|
__ms_va_list valist;
|
|
|
|
int res;
|
|
|
|
|
|
|
|
__ms_va_start(valist, locale);
|
|
|
|
res = MSVCRT_vfscanf_l(file, format, locale, valist);
|
|
|
|
__ms_va_end(valist);
|
|
|
|
return res;
|
2004-02-19 02:13:12 +01:00
|
|
|
}
|
|
|
|
|
2010-04-22 13:51:41 +02:00
|
|
|
/*********************************************************************
|
|
|
|
* fscanf_s (MSVCRT.@)
|
|
|
|
*/
|
2017-11-02 10:19:18 +01:00
|
|
|
int WINAPIV MSVCRT_fscanf_s(MSVCRT_FILE *file, const char *format, ...)
|
2010-04-22 13:51:41 +02:00
|
|
|
{
|
|
|
|
__ms_va_list valist;
|
|
|
|
int res;
|
|
|
|
|
|
|
|
__ms_va_start(valist, format);
|
|
|
|
res = MSVCRT_vfscanf_s_l(file, format, NULL, valist);
|
|
|
|
__ms_va_end(valist);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* _fscanf_s_l (MSVCRT.@)
|
|
|
|
*/
|
2017-11-02 10:19:18 +01:00
|
|
|
int WINAPIV MSVCRT__fscanf_s_l(MSVCRT_FILE *file, const char *format,
|
2010-04-22 13:51:41 +02:00
|
|
|
MSVCRT__locale_t locale, ...)
|
|
|
|
{
|
|
|
|
__ms_va_list valist;
|
|
|
|
int res;
|
|
|
|
|
|
|
|
__ms_va_start(valist, locale);
|
|
|
|
res = MSVCRT_vfscanf_s_l(file, format, locale, valist);
|
|
|
|
__ms_va_end(valist);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2004-02-19 02:13:12 +01:00
|
|
|
/*********************************************************************
|
|
|
|
* scanf (MSVCRT.@)
|
|
|
|
*/
|
2017-11-02 10:19:18 +01:00
|
|
|
int WINAPIV MSVCRT_scanf(const char *format, ...)
|
2004-02-19 02:13:12 +01:00
|
|
|
{
|
2009-01-02 21:44:40 +01:00
|
|
|
__ms_va_list valist;
|
2004-02-19 02:13:12 +01:00
|
|
|
int res;
|
|
|
|
|
2009-01-02 21:44:40 +01:00
|
|
|
__ms_va_start(valist, format);
|
2010-04-22 13:48:49 +02:00
|
|
|
res = MSVCRT_vfscanf_l(MSVCRT_stdin, format, NULL, valist);
|
2009-01-02 21:44:40 +01:00
|
|
|
__ms_va_end(valist);
|
2004-02-19 02:13:12 +01:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2010-04-22 13:49:16 +02:00
|
|
|
/*********************************************************************
|
|
|
|
* _scanf_l (MSVCRT.@)
|
|
|
|
*/
|
2017-11-02 10:19:18 +01:00
|
|
|
int WINAPIV MSVCRT__scanf_l(const char *format, MSVCRT__locale_t locale, ...)
|
2010-04-22 13:49:16 +02:00
|
|
|
{
|
|
|
|
__ms_va_list valist;
|
|
|
|
int res;
|
|
|
|
|
|
|
|
__ms_va_start(valist, locale);
|
|
|
|
res = MSVCRT_vfscanf_l(MSVCRT_stdin, format, locale, valist);
|
|
|
|
__ms_va_end(valist);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2010-04-22 13:51:57 +02:00
|
|
|
/*********************************************************************
|
|
|
|
* scanf_s (MSVCRT.@)
|
|
|
|
*/
|
2017-11-02 10:19:18 +01:00
|
|
|
int WINAPIV MSVCRT_scanf_s(const char *format, ...)
|
2010-04-22 13:51:57 +02:00
|
|
|
{
|
|
|
|
__ms_va_list valist;
|
|
|
|
int res;
|
|
|
|
|
|
|
|
__ms_va_start(valist, format);
|
|
|
|
res = MSVCRT_vfscanf_s_l(MSVCRT_stdin, format, NULL, valist);
|
|
|
|
__ms_va_end(valist);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* _scanf_s_l (MSVCRT.@)
|
|
|
|
*/
|
2017-11-02 10:19:18 +01:00
|
|
|
int WINAPIV MSVCRT__scanf_s_l(const char *format, MSVCRT__locale_t locale, ...)
|
2010-04-22 13:51:57 +02:00
|
|
|
{
|
|
|
|
__ms_va_list valist;
|
|
|
|
int res;
|
|
|
|
|
|
|
|
__ms_va_start(valist, locale);
|
|
|
|
res = MSVCRT_vfscanf_s_l(MSVCRT_stdin, format, locale, valist);
|
|
|
|
__ms_va_end(valist);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2004-02-19 02:13:12 +01:00
|
|
|
/*********************************************************************
|
|
|
|
* fwscanf (MSVCRT.@)
|
|
|
|
*/
|
2017-11-02 10:19:18 +01:00
|
|
|
int WINAPIV MSVCRT_fwscanf(MSVCRT_FILE *file, const MSVCRT_wchar_t *format, ...)
|
2004-02-19 02:13:12 +01:00
|
|
|
{
|
2009-01-02 21:44:40 +01:00
|
|
|
__ms_va_list valist;
|
2004-02-19 02:13:12 +01:00
|
|
|
int res;
|
|
|
|
|
2009-01-02 21:44:40 +01:00
|
|
|
__ms_va_start(valist, format);
|
2010-04-22 13:48:49 +02:00
|
|
|
res = MSVCRT_vfwscanf_l(file, format, NULL, valist);
|
2009-01-02 21:44:40 +01:00
|
|
|
__ms_va_end(valist);
|
2004-02-19 02:13:12 +01:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2010-04-22 13:49:35 +02:00
|
|
|
/*********************************************************************
|
|
|
|
* _fwscanf_l (MSVCRT.@)
|
|
|
|
*/
|
2017-11-02 10:19:18 +01:00
|
|
|
int WINAPIV MSVCRT__fwscanf_l(MSVCRT_FILE *file, const MSVCRT_wchar_t *format,
|
2010-04-22 13:49:35 +02:00
|
|
|
MSVCRT__locale_t locale, ...)
|
|
|
|
{
|
|
|
|
__ms_va_list valist;
|
|
|
|
int res;
|
|
|
|
|
|
|
|
__ms_va_start(valist, locale);
|
|
|
|
res = MSVCRT_vfwscanf_l(file, format, locale, valist);
|
|
|
|
__ms_va_end(valist);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2010-04-22 13:52:18 +02:00
|
|
|
/*********************************************************************
|
|
|
|
* fwscanf_s (MSVCRT.@)
|
|
|
|
*/
|
2017-11-02 10:19:18 +01:00
|
|
|
int WINAPIV MSVCRT_fwscanf_s(MSVCRT_FILE *file, const MSVCRT_wchar_t *format, ...)
|
2010-04-22 13:52:18 +02:00
|
|
|
{
|
|
|
|
__ms_va_list valist;
|
|
|
|
int res;
|
|
|
|
|
|
|
|
__ms_va_start(valist, format);
|
|
|
|
res = MSVCRT_vfwscanf_s_l(file, format, NULL, valist);
|
|
|
|
__ms_va_end(valist);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* _fwscanf_s_l (MSVCRT.@)
|
|
|
|
*/
|
2017-11-02 10:19:18 +01:00
|
|
|
int WINAPIV MSVCRT__fwscanf_s_l(MSVCRT_FILE *file, const MSVCRT_wchar_t *format,
|
2010-04-22 13:52:18 +02:00
|
|
|
MSVCRT__locale_t locale, ...)
|
|
|
|
{
|
|
|
|
__ms_va_list valist;
|
|
|
|
int res;
|
|
|
|
|
|
|
|
__ms_va_start(valist, locale);
|
|
|
|
res = MSVCRT_vfwscanf_s_l(file, format, locale, valist);
|
|
|
|
__ms_va_end(valist);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2004-02-19 02:13:12 +01:00
|
|
|
/*********************************************************************
|
|
|
|
* wscanf (MSVCRT.@)
|
|
|
|
*/
|
2017-11-02 10:19:18 +01:00
|
|
|
int WINAPIV MSVCRT_wscanf(const MSVCRT_wchar_t *format, ...)
|
2004-02-19 02:13:12 +01:00
|
|
|
{
|
2009-01-02 21:44:40 +01:00
|
|
|
__ms_va_list valist;
|
2004-02-19 02:13:12 +01:00
|
|
|
int res;
|
|
|
|
|
2009-01-02 21:44:40 +01:00
|
|
|
__ms_va_start(valist, format);
|
2010-04-22 13:48:49 +02:00
|
|
|
res = MSVCRT_vfwscanf_l(MSVCRT_stdin, format, NULL, valist);
|
2009-01-02 21:44:40 +01:00
|
|
|
__ms_va_end(valist);
|
2004-02-19 02:13:12 +01:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2010-04-22 13:49:58 +02:00
|
|
|
/*********************************************************************
|
|
|
|
* _wscanf_l (MSVCRT.@)
|
|
|
|
*/
|
2017-11-02 10:19:18 +01:00
|
|
|
int WINAPIV MSVCRT__wscanf_l(const MSVCRT_wchar_t *format,
|
2010-04-22 13:49:58 +02:00
|
|
|
MSVCRT__locale_t locale, ...)
|
|
|
|
{
|
|
|
|
__ms_va_list valist;
|
|
|
|
int res;
|
|
|
|
|
|
|
|
__ms_va_start(valist, locale);
|
|
|
|
res = MSVCRT_vfwscanf_l(MSVCRT_stdin, format, locale, valist);
|
|
|
|
__ms_va_end(valist);
|
|
|
|
return res;
|
|
|
|
}
|
2004-02-19 02:13:12 +01:00
|
|
|
|
2010-04-22 13:52:33 +02:00
|
|
|
/*********************************************************************
|
|
|
|
* wscanf_s (MSVCRT.@)
|
|
|
|
*/
|
2017-11-02 10:19:18 +01:00
|
|
|
int WINAPIV MSVCRT_wscanf_s(const MSVCRT_wchar_t *format, ...)
|
2010-04-22 13:52:33 +02:00
|
|
|
{
|
|
|
|
__ms_va_list valist;
|
|
|
|
int res;
|
|
|
|
|
|
|
|
__ms_va_start(valist, format);
|
|
|
|
res = MSVCRT_vfwscanf_s_l(MSVCRT_stdin, format, NULL, valist);
|
|
|
|
__ms_va_end(valist);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* _wscanf_s_l (MSVCRT.@)
|
|
|
|
*/
|
2017-11-02 10:19:18 +01:00
|
|
|
int WINAPIV MSVCRT__wscanf_s_l(const MSVCRT_wchar_t *format,
|
2010-04-22 13:52:33 +02:00
|
|
|
MSVCRT__locale_t locale, ...)
|
|
|
|
{
|
|
|
|
__ms_va_list valist;
|
|
|
|
int res;
|
|
|
|
|
|
|
|
__ms_va_start(valist, locale);
|
|
|
|
res = MSVCRT_vfwscanf_s_l(MSVCRT_stdin, format, locale, valist);
|
|
|
|
__ms_va_end(valist);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2004-02-19 02:13:12 +01:00
|
|
|
/*********************************************************************
|
|
|
|
* sscanf (MSVCRT.@)
|
|
|
|
*/
|
2017-11-02 10:19:18 +01:00
|
|
|
int WINAPIV MSVCRT_sscanf(const char *str, const char *format, ...)
|
2004-02-19 02:13:12 +01:00
|
|
|
{
|
2009-01-02 21:44:40 +01:00
|
|
|
__ms_va_list valist;
|
2004-02-19 02:13:12 +01:00
|
|
|
int res;
|
|
|
|
|
2009-01-02 21:44:40 +01:00
|
|
|
__ms_va_start(valist, format);
|
2010-04-22 13:48:49 +02:00
|
|
|
res = MSVCRT_vsscanf_l(str, format, NULL, valist);
|
2009-01-02 21:44:40 +01:00
|
|
|
__ms_va_end(valist);
|
2004-02-19 02:13:12 +01:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2010-04-22 13:50:20 +02:00
|
|
|
/*********************************************************************
|
|
|
|
* _sscanf_l (MSVCRT.@)
|
|
|
|
*/
|
2017-11-02 10:19:18 +01:00
|
|
|
int WINAPIV MSVCRT__sscanf_l(const char *str, const char *format,
|
2010-04-22 13:50:20 +02:00
|
|
|
MSVCRT__locale_t locale, ...)
|
|
|
|
{
|
|
|
|
__ms_va_list valist;
|
|
|
|
int res;
|
|
|
|
|
|
|
|
__ms_va_start(valist, locale);
|
|
|
|
res = MSVCRT_vsscanf_l(str, format, locale, valist);
|
|
|
|
__ms_va_end(valist);
|
|
|
|
return res;
|
|
|
|
}
|
2004-02-19 02:13:12 +01:00
|
|
|
|
2010-04-22 13:52:55 +02:00
|
|
|
/*********************************************************************
|
|
|
|
* sscanf_s (MSVCRT.@)
|
|
|
|
*/
|
2017-11-02 10:19:18 +01:00
|
|
|
int WINAPIV MSVCRT_sscanf_s(const char *str, const char *format, ...)
|
2010-04-22 13:52:55 +02:00
|
|
|
{
|
|
|
|
__ms_va_list valist;
|
|
|
|
int res;
|
|
|
|
|
|
|
|
__ms_va_start(valist, format);
|
|
|
|
res = MSVCRT_vsscanf_s_l(str, format, NULL, valist);
|
|
|
|
__ms_va_end(valist);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* _sscanf_s_l (MSVCRT.@)
|
|
|
|
*/
|
2017-11-02 10:19:18 +01:00
|
|
|
int WINAPIV MSVCRT__sscanf_s_l(const char *str, const char *format,
|
2010-04-22 13:52:55 +02:00
|
|
|
MSVCRT__locale_t locale, ...)
|
|
|
|
{
|
|
|
|
__ms_va_list valist;
|
|
|
|
int res;
|
|
|
|
|
|
|
|
__ms_va_start(valist, locale);
|
|
|
|
res = MSVCRT_vsscanf_s_l(str, format, locale, valist);
|
|
|
|
__ms_va_end(valist);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2004-02-19 02:13:12 +01:00
|
|
|
/*********************************************************************
|
|
|
|
* swscanf (MSVCRT.@)
|
|
|
|
*/
|
2017-11-02 10:19:18 +01:00
|
|
|
int WINAPIV MSVCRT_swscanf(const MSVCRT_wchar_t *str, const MSVCRT_wchar_t *format, ...)
|
2004-02-19 02:13:12 +01:00
|
|
|
{
|
2009-01-02 21:44:40 +01:00
|
|
|
__ms_va_list valist;
|
2004-02-19 02:13:12 +01:00
|
|
|
int res;
|
|
|
|
|
2009-01-02 21:44:40 +01:00
|
|
|
__ms_va_start(valist, format);
|
2010-04-22 13:48:49 +02:00
|
|
|
res = MSVCRT_vswscanf_l(str, format, NULL, valist);
|
2009-01-02 21:44:40 +01:00
|
|
|
__ms_va_end(valist);
|
2004-02-19 02:13:12 +01:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2010-04-22 13:51:03 +02:00
|
|
|
/*********************************************************************
|
|
|
|
* _swscanf_l (MSVCRT.@)
|
|
|
|
*/
|
2017-11-02 10:19:18 +01:00
|
|
|
int WINAPIV MSVCRT__swscanf_l(const MSVCRT_wchar_t *str, const MSVCRT_wchar_t *format,
|
2010-04-22 13:51:03 +02:00
|
|
|
MSVCRT__locale_t locale, ...)
|
|
|
|
{
|
|
|
|
__ms_va_list valist;
|
|
|
|
int res;
|
|
|
|
|
|
|
|
__ms_va_start(valist, locale);
|
|
|
|
res = MSVCRT_vswscanf_l(str, format, locale, valist);
|
|
|
|
__ms_va_end(valist);
|
|
|
|
return res;
|
|
|
|
}
|
2004-02-19 02:13:12 +01:00
|
|
|
|
2010-04-22 13:53:10 +02:00
|
|
|
/*********************************************************************
|
|
|
|
* swscanf_s (MSVCRT.@)
|
|
|
|
*/
|
2017-11-02 10:19:18 +01:00
|
|
|
int WINAPIV MSVCRT_swscanf_s(const MSVCRT_wchar_t *str, const MSVCRT_wchar_t *format, ...)
|
2010-04-22 13:53:10 +02:00
|
|
|
{
|
|
|
|
__ms_va_list valist;
|
|
|
|
int res;
|
|
|
|
|
|
|
|
__ms_va_start(valist, format);
|
|
|
|
res = MSVCRT_vswscanf_s_l(str, format, NULL, valist);
|
|
|
|
__ms_va_end(valist);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* _swscanf_s_l (MSVCRT.@)
|
|
|
|
*/
|
2017-11-02 10:19:18 +01:00
|
|
|
int WINAPIV MSVCRT__swscanf_s_l(const MSVCRT_wchar_t *str, const MSVCRT_wchar_t *format,
|
2010-04-22 13:53:10 +02:00
|
|
|
MSVCRT__locale_t locale, ...)
|
|
|
|
{
|
|
|
|
__ms_va_list valist;
|
|
|
|
int res;
|
|
|
|
|
|
|
|
__ms_va_start(valist, locale);
|
|
|
|
res = MSVCRT_vswscanf_s_l(str, format, locale, valist);
|
|
|
|
__ms_va_end(valist);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2004-02-19 02:13:12 +01:00
|
|
|
/*********************************************************************
|
|
|
|
* _cscanf (MSVCRT.@)
|
|
|
|
*/
|
2017-11-02 10:19:18 +01:00
|
|
|
int WINAPIV _cscanf(const char *format, ...)
|
2004-02-19 02:13:12 +01:00
|
|
|
{
|
2009-01-02 21:44:40 +01:00
|
|
|
__ms_va_list valist;
|
2004-02-19 02:13:12 +01:00
|
|
|
int res;
|
|
|
|
|
2009-01-02 21:44:40 +01:00
|
|
|
__ms_va_start(valist, format);
|
2010-04-22 13:48:49 +02:00
|
|
|
res = MSVCRT_vcscanf_l(format, NULL, valist);
|
2009-01-02 21:44:40 +01:00
|
|
|
__ms_va_end(valist);
|
2004-02-19 02:13:12 +01:00
|
|
|
return res;
|
|
|
|
}
|
2010-04-22 13:51:15 +02:00
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* _cscanf_l (MSVCRT.@)
|
|
|
|
*/
|
2017-11-02 10:19:18 +01:00
|
|
|
int WINAPIV _cscanf_l(const char *format, MSVCRT__locale_t locale, ...)
|
2010-04-22 13:51:15 +02:00
|
|
|
{
|
|
|
|
__ms_va_list valist;
|
|
|
|
int res;
|
|
|
|
|
|
|
|
__ms_va_start(valist, locale);
|
|
|
|
res = MSVCRT_vcscanf_l(format, locale, valist);
|
|
|
|
__ms_va_end(valist);
|
|
|
|
return res;
|
|
|
|
}
|
2010-04-22 13:53:28 +02:00
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* _cscanf_s (MSVCRT.@)
|
|
|
|
*/
|
2017-11-02 10:19:18 +01:00
|
|
|
int WINAPIV _cscanf_s(const char *format, ...)
|
2010-04-22 13:53:28 +02:00
|
|
|
{
|
|
|
|
__ms_va_list valist;
|
|
|
|
int res;
|
|
|
|
|
|
|
|
__ms_va_start(valist, format);
|
|
|
|
res = MSVCRT_vcscanf_s_l(format, NULL, valist);
|
|
|
|
__ms_va_end(valist);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* _cscanf_s_l (MSVCRT.@)
|
|
|
|
*/
|
2017-11-02 10:19:18 +01:00
|
|
|
int WINAPIV _cscanf_s_l(const char *format, MSVCRT__locale_t locale, ...)
|
2010-04-22 13:53:28 +02:00
|
|
|
{
|
|
|
|
__ms_va_list valist;
|
|
|
|
int res;
|
|
|
|
|
|
|
|
__ms_va_start(valist, locale);
|
|
|
|
res = MSVCRT_vcscanf_s_l(format, locale, valist);
|
|
|
|
__ms_va_end(valist);
|
|
|
|
return res;
|
|
|
|
}
|
2010-04-22 13:54:03 +02:00
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* _cwscanf (MSVCRT.@)
|
|
|
|
*/
|
2017-11-02 10:19:18 +01:00
|
|
|
int WINAPIV _cwscanf(const MSVCRT_wchar_t *format, ...)
|
2010-04-22 13:54:03 +02:00
|
|
|
{
|
|
|
|
__ms_va_list valist;
|
|
|
|
int res;
|
|
|
|
|
|
|
|
__ms_va_start(valist, format);
|
|
|
|
res = MSVCRT_vcwscanf_l(format, NULL, valist);
|
|
|
|
__ms_va_end(valist);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* _cwscanf_l (MSVCRT.@)
|
|
|
|
*/
|
2017-11-02 10:19:18 +01:00
|
|
|
int WINAPIV _cwscanf_l(const MSVCRT_wchar_t *format, MSVCRT__locale_t locale, ...)
|
2010-04-22 13:54:03 +02:00
|
|
|
{
|
|
|
|
__ms_va_list valist;
|
|
|
|
int res;
|
|
|
|
|
|
|
|
__ms_va_start(valist, locale);
|
|
|
|
res = MSVCRT_vcwscanf_l(format, locale, valist);
|
|
|
|
__ms_va_end(valist);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* _cwscanf_s (MSVCRT.@)
|
|
|
|
*/
|
2017-11-02 10:19:18 +01:00
|
|
|
int WINAPIV _cwscanf_s(const MSVCRT_wchar_t *format, ...)
|
2010-04-22 13:54:03 +02:00
|
|
|
{
|
|
|
|
__ms_va_list valist;
|
|
|
|
int res;
|
|
|
|
|
|
|
|
__ms_va_start(valist, format);
|
|
|
|
res = MSVCRT_vcwscanf_s_l(format, NULL, valist);
|
|
|
|
__ms_va_end(valist);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* _cwscanf_s_l (MSVCRT.@)
|
|
|
|
*/
|
2017-11-02 10:19:18 +01:00
|
|
|
int WINAPIV _cwscanf_s_l(const MSVCRT_wchar_t *format, MSVCRT__locale_t locale, ...)
|
2010-04-22 13:54:03 +02:00
|
|
|
{
|
|
|
|
__ms_va_list valist;
|
|
|
|
int res;
|
|
|
|
|
|
|
|
__ms_va_start(valist, locale);
|
|
|
|
res = MSVCRT_vcwscanf_s_l(format, locale, valist);
|
|
|
|
__ms_va_end(valist);
|
|
|
|
return res;
|
|
|
|
}
|
2011-04-05 17:06:58 +02:00
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* _snscanf (MSVCRT.@)
|
|
|
|
*/
|
2017-11-02 10:19:18 +01:00
|
|
|
int WINAPIV MSVCRT__snscanf(char *input, MSVCRT_size_t length, const char *format, ...)
|
2011-04-05 17:06:58 +02:00
|
|
|
{
|
|
|
|
__ms_va_list valist;
|
|
|
|
int res;
|
|
|
|
|
|
|
|
__ms_va_start(valist, format);
|
|
|
|
res = MSVCRT_vsnscanf_l(input, length, format, NULL, valist);
|
|
|
|
__ms_va_end(valist);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* _snscanf_l (MSVCRT.@)
|
|
|
|
*/
|
2017-11-02 10:19:18 +01:00
|
|
|
int WINAPIV MSVCRT__snscanf_l(char *input, MSVCRT_size_t length,
|
2011-04-05 17:06:58 +02:00
|
|
|
const char *format, MSVCRT__locale_t locale, ...)
|
|
|
|
{
|
|
|
|
__ms_va_list valist;
|
|
|
|
int res;
|
|
|
|
|
|
|
|
__ms_va_start(valist, locale);
|
|
|
|
res = MSVCRT_vsnscanf_l(input, length, format, locale, valist);
|
|
|
|
__ms_va_end(valist);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* _snscanf_s (MSVCRT.@)
|
|
|
|
*/
|
2017-11-02 10:19:18 +01:00
|
|
|
int WINAPIV MSVCRT__snscanf_s(char *input, MSVCRT_size_t length, const char *format, ...)
|
2011-04-05 17:06:58 +02:00
|
|
|
{
|
|
|
|
__ms_va_list valist;
|
|
|
|
int res;
|
|
|
|
|
|
|
|
__ms_va_start(valist, format);
|
|
|
|
res = MSVCRT_vsnscanf_s_l(input, length, format, NULL, valist);
|
|
|
|
__ms_va_end(valist);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* _snscanf_s_l (MSVCRT.@)
|
|
|
|
*/
|
2017-11-02 10:19:18 +01:00
|
|
|
int WINAPIV MSVCRT__snscanf_s_l(char *input, MSVCRT_size_t length,
|
2011-04-05 17:06:58 +02:00
|
|
|
const char *format, MSVCRT__locale_t locale, ...)
|
|
|
|
{
|
|
|
|
__ms_va_list valist;
|
|
|
|
int res;
|
|
|
|
|
|
|
|
__ms_va_start(valist, locale);
|
|
|
|
res = MSVCRT_vsnscanf_s_l(input, length, format, locale, valist);
|
|
|
|
__ms_va_end(valist);
|
|
|
|
return res;
|
|
|
|
}
|
2011-04-05 17:07:17 +02:00
|
|
|
|
2015-10-29 11:39:44 +01:00
|
|
|
|
|
|
|
/*********************************************************************
|
2017-09-04 20:06:56 +02:00
|
|
|
* __stdio_common_vsscanf (UCRTBASE.@)
|
2015-10-29 11:39:44 +01:00
|
|
|
*/
|
|
|
|
int CDECL MSVCRT__stdio_common_vsscanf(unsigned __int64 options,
|
|
|
|
const char *input, MSVCRT_size_t length,
|
|
|
|
const char *format,
|
|
|
|
MSVCRT__locale_t locale,
|
|
|
|
__ms_va_list valist)
|
|
|
|
{
|
2015-11-03 19:40:41 +01:00
|
|
|
/* LEGACY_WIDE_SPECIFIERS only has got an effect on the wide
|
|
|
|
* scanf. LEGACY_MSVCRT_COMPATIBILITY affects parsing of nan/inf,
|
|
|
|
* but parsing of those isn't implemented at all yet. */
|
|
|
|
if (options & ~UCRTBASE_SCANF_MASK)
|
2015-10-29 11:39:44 +01:00
|
|
|
FIXME("options %s not handled\n", wine_dbgstr_longlong(options));
|
2015-11-03 19:40:41 +01:00
|
|
|
if (options & UCRTBASE_SCANF_SECURECRT)
|
|
|
|
return MSVCRT_vsnscanf_s_l(input, length, format, locale, valist);
|
|
|
|
else
|
|
|
|
return MSVCRT_vsnscanf_l(input, length, format, locale, valist);
|
2015-10-29 11:39:44 +01:00
|
|
|
}
|
|
|
|
|
2016-08-24 13:58:31 +02:00
|
|
|
/*********************************************************************
|
2017-09-04 20:06:56 +02:00
|
|
|
* __stdio_common_vswscanf (UCRTBASE.@)
|
2016-08-24 13:58:31 +02:00
|
|
|
*/
|
|
|
|
int CDECL MSVCRT__stdio_common_vswscanf(unsigned __int64 options,
|
|
|
|
const MSVCRT_wchar_t *input, MSVCRT_size_t length,
|
|
|
|
const MSVCRT_wchar_t *format,
|
|
|
|
MSVCRT__locale_t locale,
|
|
|
|
__ms_va_list valist)
|
|
|
|
{
|
|
|
|
/* LEGACY_WIDE_SPECIFIERS only has got an effect on the wide
|
|
|
|
* scanf. LEGACY_MSVCRT_COMPATIBILITY affects parsing of nan/inf,
|
|
|
|
* but parsing of those isn't implemented at all yet. */
|
|
|
|
if (options & ~UCRTBASE_SCANF_MASK)
|
|
|
|
FIXME("options %s not handled\n", wine_dbgstr_longlong(options));
|
|
|
|
if (options & UCRTBASE_SCANF_SECURECRT)
|
|
|
|
return MSVCRT_vsnwscanf_s_l(input, length, format, locale, valist);
|
|
|
|
else
|
|
|
|
return MSVCRT_vsnwscanf_l(input, length, format, locale, valist);
|
|
|
|
}
|
|
|
|
|
2016-08-24 13:58:32 +02:00
|
|
|
/*********************************************************************
|
2017-09-04 20:06:56 +02:00
|
|
|
* __stdio_common_vfscanf (UCRTBASE.@)
|
2016-08-24 13:58:32 +02:00
|
|
|
*/
|
|
|
|
int CDECL MSVCRT__stdio_common_vfscanf(unsigned __int64 options,
|
|
|
|
MSVCRT_FILE *file,
|
|
|
|
const char *format,
|
|
|
|
MSVCRT__locale_t locale,
|
|
|
|
__ms_va_list valist)
|
|
|
|
{
|
|
|
|
if (options & ~UCRTBASE_SCANF_SECURECRT)
|
|
|
|
FIXME("options %s not handled\n", wine_dbgstr_longlong(options));
|
|
|
|
if (options & UCRTBASE_SCANF_SECURECRT)
|
|
|
|
return MSVCRT_vfscanf_s_l(file, format, locale, valist);
|
|
|
|
else
|
|
|
|
return MSVCRT_vfscanf_l(file, format, locale, valist);
|
|
|
|
}
|
|
|
|
|
2016-08-08 23:02:16 +02:00
|
|
|
/*********************************************************************
|
2017-09-04 20:06:56 +02:00
|
|
|
* __stdio_common_vfwscanf (UCRTBASE.@)
|
2016-08-08 23:02:16 +02:00
|
|
|
*/
|
|
|
|
int CDECL MSVCRT__stdio_common_vfwscanf(unsigned __int64 options,
|
|
|
|
MSVCRT_FILE *file,
|
|
|
|
const MSVCRT_wchar_t *format,
|
|
|
|
MSVCRT__locale_t locale,
|
|
|
|
__ms_va_list valist)
|
|
|
|
{
|
|
|
|
if (options & ~UCRTBASE_SCANF_SECURECRT)
|
|
|
|
FIXME("options %s not handled\n", wine_dbgstr_longlong(options));
|
|
|
|
if (options & UCRTBASE_SCANF_SECURECRT)
|
|
|
|
return MSVCRT_vfwscanf_s_l(file, format, locale, valist);
|
|
|
|
else
|
|
|
|
return MSVCRT_vfwscanf_l(file, format, locale, valist);
|
|
|
|
}
|
|
|
|
|
2011-04-05 17:07:17 +02:00
|
|
|
/*********************************************************************
|
|
|
|
* _snwscanf (MSVCRT.@)
|
|
|
|
*/
|
2017-11-02 10:19:18 +01:00
|
|
|
int WINAPIV MSVCRT__snwscanf(MSVCRT_wchar_t *input, MSVCRT_size_t length,
|
2011-04-05 17:07:17 +02:00
|
|
|
const MSVCRT_wchar_t *format, ...)
|
|
|
|
{
|
|
|
|
__ms_va_list valist;
|
|
|
|
int res;
|
|
|
|
|
|
|
|
__ms_va_start(valist, format);
|
|
|
|
res = MSVCRT_vsnwscanf_l(input, length, format, NULL, valist);
|
|
|
|
__ms_va_end(valist);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* _snwscanf_l (MSVCRT.@)
|
|
|
|
*/
|
2017-11-02 10:19:18 +01:00
|
|
|
int WINAPIV MSVCRT__snwscanf_l(MSVCRT_wchar_t *input, MSVCRT_size_t length,
|
2011-04-05 17:07:17 +02:00
|
|
|
const MSVCRT_wchar_t *format, MSVCRT__locale_t locale, ...)
|
|
|
|
{
|
|
|
|
__ms_va_list valist;
|
|
|
|
int res;
|
|
|
|
|
|
|
|
__ms_va_start(valist, locale);
|
|
|
|
res = MSVCRT_vsnwscanf_l(input, length, format, locale, valist);
|
|
|
|
__ms_va_end(valist);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* _snwscanf_s (MSVCRT.@)
|
|
|
|
*/
|
2017-11-02 10:19:18 +01:00
|
|
|
int WINAPIV MSVCRT__snwscanf_s(MSVCRT_wchar_t *input, MSVCRT_size_t length,
|
2011-04-05 17:07:17 +02:00
|
|
|
const MSVCRT_wchar_t *format, ...)
|
|
|
|
{
|
|
|
|
__ms_va_list valist;
|
|
|
|
int res;
|
|
|
|
|
|
|
|
__ms_va_start(valist, format);
|
|
|
|
res = MSVCRT_vsnwscanf_s_l(input, length, format, NULL, valist);
|
|
|
|
__ms_va_end(valist);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* _snscanf_s_l (MSVCRT.@)
|
|
|
|
*/
|
2017-11-02 10:19:18 +01:00
|
|
|
int WINAPIV MSVCRT__snwscanf_s_l(MSVCRT_wchar_t *input, MSVCRT_size_t length,
|
2011-04-05 17:07:17 +02:00
|
|
|
const MSVCRT_wchar_t *format, MSVCRT__locale_t locale, ...)
|
|
|
|
{
|
|
|
|
__ms_va_list valist;
|
|
|
|
int res;
|
|
|
|
|
|
|
|
__ms_va_start(valist, locale);
|
|
|
|
res = MSVCRT_vsnwscanf_s_l(input, length, format, locale, valist);
|
|
|
|
__ms_va_end(valist);
|
|
|
|
return res;
|
|
|
|
}
|
2017-09-23 19:16:45 +02:00
|
|
|
|
2017-12-28 18:46:54 +01:00
|
|
|
#if _MSVCR_VER>=120
|
|
|
|
|
2017-09-23 19:16:45 +02:00
|
|
|
/*********************************************************************
|
|
|
|
* vsscanf (MSVCRT120.@)
|
|
|
|
*/
|
|
|
|
int CDECL MSVCRT_vsscanf(const char *buffer, const char *format, __ms_va_list valist)
|
|
|
|
{
|
|
|
|
if (!MSVCRT_CHECK_PMT(buffer != NULL && format != NULL)) return -1;
|
|
|
|
|
|
|
|
return MSVCRT_vsscanf_l(buffer, format, NULL, valist);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* vswscanf (MSVCRT120.@)
|
|
|
|
*/
|
|
|
|
int CDECL MSVCRT_vswscanf(const MSVCRT_wchar_t *buffer, const MSVCRT_wchar_t *format, __ms_va_list valist)
|
|
|
|
{
|
|
|
|
if (!MSVCRT_CHECK_PMT(buffer != NULL && format != NULL)) return -1;
|
|
|
|
|
|
|
|
return MSVCRT_vswscanf_l(buffer, format, NULL, valist);
|
|
|
|
}
|
2017-12-28 18:46:54 +01:00
|
|
|
|
|
|
|
#endif /* _MSVCR_VER>=120 */
|