]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.c
ShellPkg: Update "ls" command to better handle "-r" parameter
[mirror_edk2.git] / ShellPkg / Library / UefiShellLevel2CommandsLib / UefiShellLevel2CommandsLib.c
index ce3d87ba502f745bf9e9a17f85e4c71c455bf053..fe8765f21448c577fc6da84ae7a5f8e63b5af7ae 100644 (file)
@@ -22,7 +22,7 @@
   * functions are non-interactive only\r
 \r
 \r
-  Copyright (c) 2009 - 2011, 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
 \r
 CONST CHAR16 mFileName[] = L"ShellCommands";\r
 EFI_HANDLE gShellLevel2HiiHandle = NULL;\r
-CONST EFI_GUID gShellLevel2HiiGuid = \\r
-  { \\r
-    0xf95a7ccc, 0x4c55, 0x4426, { 0xa7, 0xb4, 0xdc, 0x89, 0x61, 0x95, 0xb, 0xae } \\r
-  };\r
 \r
 /**\r
   Get the filename to get help text from if not using HII.\r
@@ -97,7 +93,7 @@ ShellLevel2CommandsLibConstructor (
   ShellCommandRegisterCommandName(L"mv",       ShellCommandRunMv      , ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_MV)     );\r
   ShellCommandRegisterCommandName(L"parse",    ShellCommandRunParse   , ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_PARSE)  );\r
   ShellCommandRegisterCommandName(L"reset",    ShellCommandRunReset   , ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_RESET)  );\r
-  ShellCommandRegisterCommandName(L"set",      ShellCommandRunSet     , ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_SET)    );\r
+  ShellCommandRegisterCommandName(L"set",      ShellCommandRunSet     , ShellCommandGetManFileNameLevel2, 2, L"",FALSE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_SET)    );\r
   ShellCommandRegisterCommandName(L"ls",       ShellCommandRunLs      , ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_LS)     );\r
   ShellCommandRegisterCommandName(L"rm",       ShellCommandRunRm      , ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_RM)     );\r
   ShellCommandRegisterCommandName(L"vol",      ShellCommandRunVol     , ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_VOL)    );\r
@@ -167,8 +163,8 @@ ShellLevel2CommandsLibDestructor (
   @param[in] Path         The unknown Path Value\r
 \r
   @retval NULL            A memory allocation failed\r
-  @retval NULL            a fully qualified path could not be discovered.\r
-  @retval other           pointer to a fuly qualified path.\r
+  @retval NULL            A fully qualified path could not be discovered.\r
+  @retval other           An allocated pointer to a fuly qualified path.\r
 **/\r
 CHAR16*\r
 EFIAPI\r
@@ -198,6 +194,10 @@ GetFullyQualifiedPath(
 \r
   PathCleanUpDirectories(PathToReturn);\r
 \r
+  if (PathToReturn == NULL) {\r
+    return NULL;\r
+  }\r
+\r
   while (PathToReturn[StrLen(PathToReturn)-1] == L'*') {\r
     PathToReturn[StrLen(PathToReturn)-1] = CHAR_NULL;\r
   }\r
@@ -230,6 +230,10 @@ VerifyIntermediateDirectories (
   PathCopy    = StrnCatGrow(&PathCopy, NULL, Path, 0);\r
   FileHandle  = NULL;\r
 \r
+  if (PathCopy == NULL) {\r
+    return (EFI_OUT_OF_RESOURCES);\r
+  }\r
+\r
   for (TempSpot = &PathCopy[StrLen(PathCopy)-1] ; *TempSpot != CHAR_NULL && *TempSpot != L'\\' ; TempSpot = &PathCopy[StrLen(PathCopy)-1]){\r
     *TempSpot = CHAR_NULL;\r
   }\r