-/* $NetBSD: fgetstr.c,v 1.4 2006/11/24 19:46:58 christos Exp $ */\r
+/*\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.\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
\r
-/*-\r
* Copyright (c) 1990, 1993\r
* The Regents of the University of California. All rights reserved.\r
*\r
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
* SUCH DAMAGE.\r
+\r
+ $NetBSD: fgetstr.c,v 1.4 2006/11/24 19:46:58 christos Exp $\r
+ fgetline.c 8.1 (Berkeley) 6/4/93\r
+*/\r
+\r
+/*-\r
*/\r
#include <LibConfig.h>\r
#include <sys/EfiCdefs.h>\r
-#if defined(LIBC_SCCS) && !defined(lint)\r
-#if 0\r
-static char sccsid[] = "@(#)fgetline.c 8.1 (Berkeley) 6/4/93";\r
-#else\r
-__RCSID("$NetBSD: fgetstr.c,v 1.4 2006/11/24 19:46:58 christos Exp $");\r
-#endif\r
-#endif /* LIBC_SCCS and not lint */\r
\r
#include "namespace.h"\r
\r
#include <assert.h>\r
+#include <errno.h>\r
#include <stdio.h>\r
#include <stdlib.h>\r
#include <string.h>\r
++newsize;\r
#endif\r
_DIAGASSERT(fp != NULL);\r
+ if(fp == NULL) {\r
+ errno = EINVAL;\r
+ return (-1);\r
+ }\r
\r
if ((size_t)fp->_lb._size >= newsize)\r
return (0);\r
\r
_DIAGASSERT(fp != NULL);\r
_DIAGASSERT(lenp != NULL);\r
+ if(fp == NULL) {\r
+ errno = EINVAL;\r
+ return (NULL);\r
+ }\r
\r
/* make sure there is input */\r
if (fp->_r <= 0 && __srefill(fp)) {\r