]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellLevel3CommandsLib/Type.c
Update all the code to consume the ConvertDevicePathToText, ConvertDevicePathNodeToTe...
[mirror_edk2.git] / ShellPkg / Library / UefiShellLevel3CommandsLib / Type.c
index 05f13f07565da2ec9f4eaa7f11a69399645d47be..3e4ccb36e34c7cae73984e3e204e846267e13c68 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Main file for Type shell level 3 function.\r
 \r
-  Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved. <BR>\r
+  Copyright (c) 2009 - 2011, 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
 \r
 #include <Library/ShellLib.h>\r
 \r
+/**\r
+  Display a single file to StdOut.\r
+\r
+  If both Ascii and UCS2 are FALSE attempt to discover the file type.\r
+\r
+  @param[in] Handle   The handle to the file to display.\r
+  @param[in] Ascii    TRUE to force ASCII, FALSE othewise.\r
+  @param[in] UCS2     TRUE to force UCS2, FALSE othewise.\r
+\r
+  @retval EFI_OUT_OF_RESOURCES  A memory allocation failed.\r
+  @retval EFI_SUCCESS           The operation was successful.\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 TypeFileByHandle (\r
@@ -31,7 +43,7 @@ TypeFileByHandle (
   CHAR16      AsciiChar;\r
 \r
   ReadSize = PcdGet16(PcdShellFileOperationSize);\r
-  Buffer = AllocatePool(ReadSize);\r
+  Buffer = AllocateZeroPool(ReadSize);\r
   if (Buffer == NULL) {\r
     return (EFI_OUT_OF_RESOURCES);\r
   }\r
@@ -47,7 +59,7 @@ TypeFileByHandle (
     }\r
 \r
     if (!(Ascii|UCS2)){\r
-      if (*(UINT16*)Buffer == UnicodeFileTag) {\r
+      if (*(UINT16*)Buffer == gUnicodeFileTag) {\r
         UCS2 = TRUE;\r
         Buffer = ((UINT16*)Buffer) + 1;\r
       } else {\r
@@ -71,7 +83,7 @@ TypeFileByHandle (
       Print(L"%s", Buffer);\r
     }\r
   }\r
-  Status = Print(L"\r\n", Buffer);\r
+  Print(L"\r\n", Buffer);\r
   return (Status);\r
 }\r
 \r
@@ -161,6 +173,7 @@ ShellCommandRunType (
          ){\r
         Status = ShellOpenFileMetaArg((CHAR16*)Param, EFI_FILE_MODE_READ, &FileList);\r
         if (EFI_ERROR(Status)) {\r
+          ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellLevel3HiiHandle, (CHAR16*)Param);\r
           ShellStatus = SHELL_NOT_FOUND;\r
           break;\r
         }\r