]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellLevel2CommandsLib/Map.c
ShellPkg: fix display for map command with filtering
[mirror_edk2.git] / ShellPkg / Library / UefiShellLevel2CommandsLib / Map.c
index 9e33286c90db5f16f742e922519a6661c229481c..4865d0e7a11afd3c57fd99cf6be03ee1a9003eed 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Main file for map shell level 2 command.\r
 \r
-  Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2014, 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
@@ -345,6 +345,7 @@ MappingListHasType(
     FreePool(NewSpecific);\r
   }\r
   if (  Consist\r
+    && !Specific\r
     && (SearchList(MapList, L"HD*",  NULL, TRUE, TRUE, L";")\r
       ||SearchList(MapList, L"CD*",  NULL, TRUE, TRUE, L";")\r
       ||SearchList(MapList, L"F*",   NULL, TRUE, TRUE, L";")\r
@@ -353,6 +354,7 @@ MappingListHasType(
   }\r
 \r
   if (  Normal\r
+    && !Specific\r
     && (SearchList(MapList, L"FS",  NULL, FALSE, TRUE, L";")\r
       ||SearchList(MapList, L"BLK", NULL, FALSE, TRUE, L";"))){\r
     return (TRUE);\r
@@ -416,7 +418,11 @@ PerformSingleMappingDisplay(
     return EFI_NOT_FOUND;\r
   }\r
 \r
-  if (Normal) {\r
+  if (Normal || !Consist) {\r
+    //\r
+    // need the Normal here since people can use both on command line.  otherwise unused.\r
+    //\r
+\r
     //\r
     // Allocate a name\r
     //\r
@@ -434,7 +440,7 @@ PerformSingleMappingDisplay(
     if (TempSpot != NULL) {\r
       *TempSpot = CHAR_NULL;\r
     }\r
-  } else if (Consist) {\r
+  } else {\r
     CurrentName = NULL;\r
 \r
     //\r
@@ -485,16 +491,10 @@ PerformSingleMappingDisplay(
         Alias[StrLen(Alias)-1] = CHAR_NULL;\r
       }\r
     }\r
-  } else {\r
-    CurrentName = NULL;\r
-    CurrentName = StrnCatGrow(&CurrentName, 0, L"", 0);\r
-    if (CurrentName == NULL) {\r
-      return (EFI_OUT_OF_RESOURCES);\r
-    }\r
   }\r
   DevPathString = ConvertDevicePathToText(DevPath, TRUE, FALSE);\r
+  TempLen = StrLen(CurrentName);\r
   if (!SFO) {\r
-    TempLen = StrLen(CurrentName);\r
     ShellPrintHiiEx (\r
       -1,\r
       -1,\r
@@ -528,7 +528,6 @@ PerformSingleMappingDisplay(
       SHELL_FREE_NON_NULL(MediaType);\r
     }\r
   } else {\r
-    TempLen = StrLen(CurrentName);\r
     ShellPrintHiiEx (\r
       -1,\r
       -1,\r