/** @file\r
Provides interface to shell functionality for shell commands and applications.\r
\r
- Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r
+ Copyright 2016 Dell Inc.\r
+ Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
Status = ShellFileHandleReadLine(Handle, RetVal, &Size, FALSE, Ascii);\r
\r
}\r
+ if (Status == EFI_END_OF_FILE && RetVal != NULL && *RetVal != CHAR_NULL) {\r
+ Status = EFI_SUCCESS;\r
+ }\r
if (EFI_ERROR(Status) && (RetVal != NULL)) {\r
FreePool(RetVal);\r
RetVal = NULL;\r
If the position upon start is 0, then the Ascii Boolean will be set. This should be\r
maintained and not changed for all operations with the same file.\r
\r
+ NOTE: LINES THAT ARE RETURNED BY THIS FUNCTION ARE UCS2, EVEN IF THE FILE BEING READ\r
+ IS IN ASCII FORMAT.\r
+\r
@param[in] Handle SHELL_FILE_HANDLE to read from.\r
- @param[in, out] Buffer The pointer to buffer to read into.\r
- @param[in, out] Size The pointer to number of bytes in Buffer.\r
+ @param[in, out] Buffer The pointer to buffer to read into. If this function\r
+ returns EFI_SUCCESS, then on output Buffer will\r
+ contain a UCS2 string, even if the file being\r
+ read is ASCII.\r
+ @param[in, out] Size On input, pointer to number of bytes in Buffer.\r
+ On output, unchanged unless Buffer is too small\r
+ to contain the next line of the file. In that\r
+ case Size is set to the number of bytes needed\r
+ to hold the next line of the file (as a UCS2\r
+ string, even if it is an ASCII file).\r
@param[in] Truncate If the buffer is large enough, this has no effect.\r
If the buffer is is too small and Truncate is TRUE,\r
the line will be truncated.\r
\r
@retval EFI_SUCCESS The operation was successful. The line is stored in\r
Buffer.\r
+ @retval EFI_END_OF_FILE There are no more lines in the file.\r
@retval EFI_INVALID_PARAMETER Handle was NULL.\r
@retval EFI_INVALID_PARAMETER Size was NULL.\r
@retval EFI_BUFFER_TOO_SMALL Size was not large enough to store the line.\r
}\r
}\r
\r
+ if (*Ascii) {\r
+ CharSize = sizeof(CHAR8);\r
+ } else {\r
+ CharSize = sizeof(CHAR16);\r
+ }\r
for (CountSoFar = 0;;CountSoFar++){\r
CharBuffer = 0;\r
- if (*Ascii) {\r
- CharSize = sizeof(CHAR8);\r
- } else {\r
- CharSize = sizeof(CHAR16);\r
- }\r
Status = gEfiShellProtocol->ReadFile(Handle, &CharSize, &CharBuffer);\r
if ( EFI_ERROR(Status)\r
|| CharSize == 0\r
|| (CharBuffer == L'\n' && !(*Ascii))\r
|| (CharBuffer == '\n' && *Ascii)\r
){\r
+ if (CharSize == 0) {\r
+ Status = EFI_END_OF_FILE;\r
+ }\r
break;\r
}\r
//\r