/** @file\r
Implementation of scanf internals for <stdio.h>.\r
\r
- Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials are licensed and made available\r
under the terms and conditions of the BSD License that accompanies this\r
distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php.\r
+ http://opensource.org/licenses/bsd-license.\r
\r
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
FreeBSD: src/lib/libc/stdio/vfscanf.c,v 1.41 2007/01/09 00:28:07 imp Exp\r
vfscanf.c 8.1 (Berkeley) 6/4/93\r
**/\r
-//#include <Uefi.h> // REMOVE, For DEBUG only\r
-//#include <Library/UefiLib.h> // REMOVE, For DEBUG only\r
-\r
#include <LibConfig.h>\r
\r
#include "namespace.h"\r
#include <assert.h>\r
#include <ctype.h>\r
+#include <errno.h>\r
#include <inttypes.h>\r
#include <stdio.h>\r
#include <stdlib.h>\r
#endif\r
\r
/*\r
- * Provide an external name for vfscanf. Note, we don't use the normal\r
+ * Provide an external name for vfscanf. Note, EFI uses the normal\r
* namespace.h method; stdio routines explicitly use the internal name\r
* __svfscanf.\r
*/\r
{\r
int ret;\r
\r
+ if(fp == NULL) {\r
+ errno = EINVAL;\r
+ return (EOF);\r
+ }\r
FLOCKFILE(fp);\r
ret = __svfscanf_unlocked(fp, fmt0, ap);\r
FUNLOCKFILE(fp);\r
\r
_DIAGASSERT(fp != NULL);\r
_DIAGASSERT(fmt0 != NULL);\r
+ if(fp == NULL) {\r
+ errno = EINVAL;\r
+ return (EOF);\r
+ }\r
\r
_SET_ORIENTATION(fp, -1);\r
\r
goto match_failure;\r
if ((flags & SUPPRESS) == 0) {\r
if (flags & LONGDBL) {\r
-/*dvm*/ long double **mp = (long double **)ap;\r
+ long double **mp = (long double **)ap;\r
long double res = strtold(buf, &p);\r
\r
-/*dvm*/ *(*mp) = res;\r
-/*dvm*/ ap += sizeof(long double *);\r
-/*dvm*/ //*va_arg(ap, long double *) = res;\r
+ *(*mp) = res;\r
+ ap += sizeof(long double *);\r
+/*???*/ //*va_arg(ap, long double *) = res;\r
} else if (flags & LONG) {\r
double res = strtod(buf, &p);\r
*va_arg(ap, double *) = res;\r
char decpt = *localeconv()->decimal_point;\r
_Bool gotmantdig = 0, ishex = 0;\r
\r
+ if(fp == NULL) {\r
+ errno = EINVAL;\r
+ return (EOF);\r
+ }\r
+\r
/*\r
* We set commit = p whenever the string we have read so far\r
* constitutes a valid representation of a floating point\r