]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Revert "ShellPkg: Move FindFirstCharacter/GetNextParameter to ShellCommandLib"
authorRuiyu Ni <ruiyu.ni@intel.com>
Tue, 23 Aug 2016 02:40:55 +0000 (10:40 +0800)
committerRuiyu Ni <ruiyu.ni@intel.com>
Thu, 25 Aug 2016 05:00:47 +0000 (13:00 +0800)
This reverts commit c0bcd3433f33876c519bf5567e0ab69261b57fe9.
The above commit causes several regression of "echo" command:
1. Double quotes are not being stripped from the final text. UEFI Shell 2.2 section 3.4.5 chops out the quotes.
2. Output redirection is not working as expected. Text is being redirected, but the ‘> …’ text should not be.
3. Inconsistent special character handling.  For example, comments with # seem to be parsed out correctly, but handing of ^ is incorrect.
In summary, ‘echo “You are ^#1” > t.txt’ results in the below content in t.txt:
 “You are ^#1” > t.txt

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Tapan Shah <tapandshah@hpe.com>
ShellPkg/Application/Shell/Shell.c
ShellPkg/Application/Shell/Shell.h
ShellPkg/Application/Shell/ShellParametersProtocol.c
ShellPkg/Application/Shell/ShellParametersProtocol.h
ShellPkg/Include/Library/ShellCommandLib.h
ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c

index 3080a1644f6e49ca70fba285b15ab306910c7270..0b6362e92677882eda60ba6c74c86169e6b1760c 100644 (file)
@@ -213,7 +213,7 @@ ContainsSplit(
 \r
   FirstQuote    = FindNextInstance (CmdLine, L"\"", TRUE);\r
   SecondQuote   = NULL;\r
-  TempSpot      = ShellFindFirstCharacter(CmdLine, L"|", TRUE);\r
+  TempSpot      = FindFirstCharacter(CmdLine, L"|", L'^');\r
 \r
   if (FirstQuote == NULL    || \r
       TempSpot == NULL      || \r
@@ -236,7 +236,7 @@ ContainsSplit(
       continue;\r
     } else {\r
       FirstQuote = FindNextInstance (SecondQuote + 1, L"\"", TRUE);\r
-      TempSpot = ShellFindFirstCharacter(TempSpot + 1, L"|", TRUE);\r
+      TempSpot = FindFirstCharacter(TempSpot + 1, L"|", L'^');\r
       continue;\r
     } \r
   }\r
@@ -716,7 +716,6 @@ FreeResources:
   }\r
 \r
   ShellFreeEnvVarList ();\r
-  ShellSetRawCmdLine (NULL);\r
 \r
   if (ShellCommandGetExit()) {\r
     return ((EFI_STATUS)ShellCommandGetExitCode());\r
@@ -1993,7 +1992,7 @@ IsValidSplit(
       return (EFI_OUT_OF_RESOURCES);\r
     }\r
     TempWalker = (CHAR16*)Temp;\r
-    if (!EFI_ERROR (ShellGetNextParameter (&TempWalker, FirstParameter, StrSize(CmdLine), TRUE))) {\r
+    if (!EFI_ERROR(GetNextParameter(&TempWalker, &FirstParameter, StrSize(CmdLine), TRUE))) {\r
       if (GetOperationType(FirstParameter) == Unknown_Invalid) {\r
         ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_NOT_FOUND), ShellInfoObject.HiiHandle, FirstParameter);\r
         SetLastError(SHELL_NOT_FOUND);\r
@@ -2042,7 +2041,7 @@ VerifySplit(
   //\r
   // recurse to verify the next item\r
   //\r
-  TempSpot = ShellFindFirstCharacter(CmdLine, L"|", TRUE) + 1;\r
+  TempSpot = FindFirstCharacter(CmdLine, L"|", L'^') + 1;\r
   if (*TempSpot == L'a' && \r
       (*(TempSpot + 1) == L' ' || *(TempSpot + 1) == CHAR_NULL)\r
      ) {\r
@@ -2159,7 +2158,7 @@ DoHelpUpdate(
 \r
   Walker = *CmdLine;\r
   while(Walker != NULL && *Walker != CHAR_NULL) {\r
-    if (!EFI_ERROR (ShellGetNextParameter (&Walker, CurrentParameter, StrSize(*CmdLine), TRUE))) {\r
+    if (!EFI_ERROR(GetNextParameter(&Walker, &CurrentParameter, StrSize(*CmdLine), TRUE))) {\r
       if (StrStr(CurrentParameter, L"-?") == CurrentParameter) {\r
         CurrentParameter[0] = L' ';\r
         CurrentParameter[1] = L' ';\r
@@ -2590,7 +2589,6 @@ RunShellCommand(
   CHAR16                    *FirstParameter;\r
   CHAR16                    *TempWalker;\r
   SHELL_OPERATION_TYPES     Type;\r
-  CHAR16                    *OldCmdLine;\r
 \r
   ASSERT(CmdLine != NULL);\r
   if (StrLen(CmdLine) == 0) {\r
@@ -2598,14 +2596,11 @@ RunShellCommand(
   }\r
 \r
   Status              = EFI_SUCCESS;\r
-  FirstParameter      = NULL;\r
   CleanOriginal       = NULL;\r
-  OldCmdLine          = NULL;\r
 \r
   CleanOriginal = StrnCatGrow(&CleanOriginal, NULL, CmdLine, 0);\r
   if (CleanOriginal == NULL) {\r
-    Status = EFI_OUT_OF_RESOURCES;\r
-    goto Done;\r
+    return (EFI_OUT_OF_RESOURCES);\r
   }\r
 \r
   TrimSpaces(&CleanOriginal);\r
@@ -2632,36 +2627,35 @@ RunShellCommand(
   // Handle case that passed in command line is just 1 or more " " characters.\r
   //\r
   if (StrLen (CleanOriginal) == 0) {\r
-    Status = EFI_SUCCESS;\r
-    goto Done;\r
+    SHELL_FREE_NON_NULL(CleanOriginal);\r
+    return (EFI_SUCCESS);\r
   }\r
 \r
   Status = ProcessCommandLineToFinal(&CleanOriginal);\r
   if (EFI_ERROR(Status)) {\r
-    goto Done;\r
+    SHELL_FREE_NON_NULL(CleanOriginal);\r
+    return (Status);\r
   }\r
 \r
-  OldCmdLine = ShellGetRawCmdLine ();\r
-  ShellSetRawCmdLine (CleanOriginal);\r
-\r
   //\r
   // We don't do normal processing with a split command line (output from one command input to another)\r
   //\r
   if (ContainsSplit(CleanOriginal)) {\r
     Status = ProcessNewSplitCommandLine(CleanOriginal);\r
-    goto Done;\r
-  }\r
+    SHELL_FREE_NON_NULL(CleanOriginal);\r
+    return (Status);\r
+  } \r
 \r
   //\r
   // We need the first parameter information so we can determine the operation type\r
   //\r
   FirstParameter = AllocateZeroPool(StrSize(CleanOriginal));\r
   if (FirstParameter == NULL) {\r
-    Status = EFI_OUT_OF_RESOURCES;\r
-    goto Done;\r
+    SHELL_FREE_NON_NULL(CleanOriginal);\r
+    return (EFI_OUT_OF_RESOURCES);\r
   }\r
   TempWalker = CleanOriginal;\r
-  if (!EFI_ERROR (ShellGetNextParameter (&TempWalker, FirstParameter, StrSize(CleanOriginal), TRUE))) {\r
+  if (!EFI_ERROR(GetNextParameter(&TempWalker, &FirstParameter, StrSize(CleanOriginal), TRUE))) {\r
     //\r
     // Depending on the first parameter we change the behavior\r
     //\r
@@ -2686,12 +2680,9 @@ RunShellCommand(
     ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_NOT_FOUND), ShellInfoObject.HiiHandle, FirstParameter);\r
     SetLastError(SHELL_NOT_FOUND);\r
   }\r
-\r
-Done:\r
-  ShellSetRawCmdLine (OldCmdLine);\r
-  SHELL_FREE_NON_NULL (OldCmdLine);\r
-  SHELL_FREE_NON_NULL (CleanOriginal);\r
-  SHELL_FREE_NON_NULL (FirstParameter);\r
\r
+  SHELL_FREE_NON_NULL(CleanOriginal);\r
+  SHELL_FREE_NON_NULL(FirstParameter);\r
 \r
   return (Status);\r
 }\r
@@ -3129,3 +3120,37 @@ RunScriptFile (
   return (Status);\r
 }\r
 \r
+/**\r
+  Return the pointer to the first occurrence of any character from a list of characters.\r
+\r
+  @param[in] String           the string to parse\r
+  @param[in] CharacterList    the list of character to look for\r
+  @param[in] EscapeCharacter  An escape character to skip\r
+\r
+  @return the location of the first character in the string\r
+  @retval CHAR_NULL no instance of any character in CharacterList was found in String\r
+**/\r
+CONST CHAR16*\r
+EFIAPI\r
+FindFirstCharacter(\r
+  IN CONST CHAR16 *String,\r
+  IN CONST CHAR16 *CharacterList,\r
+  IN CONST CHAR16 EscapeCharacter\r
+  )\r
+{\r
+  UINT32 WalkChar;\r
+  UINT32 WalkStr;\r
+\r
+  for (WalkStr = 0; WalkStr < StrLen(String); WalkStr++) {\r
+    if (String[WalkStr] == EscapeCharacter) {\r
+      WalkStr++;\r
+      continue;\r
+    }\r
+    for (WalkChar = 0; WalkChar < StrLen(CharacterList); WalkChar++) {\r
+      if (String[WalkStr] == CharacterList[WalkChar]) {\r
+        return (&String[WalkStr]);\r
+      }\r
+    }\r
+  }\r
+  return (String + StrLen(String));\r
+}\r
index a34c91ad1e5d73018477b3e31b9a82a0b137f4b6..29b36b003a52ff1281c80ee1e8b25c574f689143 100644 (file)
@@ -370,6 +370,24 @@ RunScriptFile (
   IN EFI_SHELL_PARAMETERS_PROTOCOL  *ParamProtocol\r
   );\r
 \r
+/**\r
+  Return the pointer to the first occurrence of any character from a list of characters.\r
+\r
+  @param[in] String           the string to parse\r
+  @param[in] CharacterList    the list of character to look for\r
+  @param[in] EscapeCharacter  An escape character to skip\r
+\r
+  @return the location of the first character in the string\r
+  @retval CHAR_NULL no instance of any character in CharacterList was found in String\r
+**/\r
+CONST CHAR16*\r
+EFIAPI\r
+FindFirstCharacter(\r
+  IN CONST CHAR16 *String,\r
+  IN CONST CHAR16 *CharacterList,\r
+  IN CONST CHAR16 EscapeCharacter\r
+  );\r
+\r
 /**\r
   Cleans off leading and trailing spaces and tabs.\r
 \r
index 0785902b169a553e3ccf9f5d4fc9a05c035ec6cd..3684f9cd827b175d2abcde6b07e042c15b6d351e 100644 (file)
 \r
 BOOLEAN AsciiRedirection = FALSE;\r
 \r
+/**\r
+  Return the next parameter's end from a command line string.\r
+\r
+  @param[in] String        the string to parse\r
+**/\r
+CONST CHAR16*\r
+EFIAPI\r
+FindEndOfParameter(\r
+  IN CONST CHAR16 *String\r
+  )\r
+{\r
+  CONST CHAR16 *First;\r
+  CONST CHAR16 *CloseQuote;\r
+\r
+  First = FindFirstCharacter(String, L" \"", L'^');\r
+\r
+  //\r
+  // nothing, all one parameter remaining\r
+  //\r
+  if (*First == CHAR_NULL) {\r
+    return (First);\r
+  }\r
+\r
+  //\r
+  // If space before a quote (or neither found, i.e. both CHAR_NULL),\r
+  // then that's the end.\r
+  //\r
+  if (*First == L' ') {\r
+    return (First);\r
+  }\r
+\r
+  CloseQuote = FindFirstCharacter (First+1, L"\"", L'^');\r
+\r
+  //\r
+  // We did not find a terminator...\r
+  //\r
+  if (*CloseQuote == CHAR_NULL) {\r
+    return (NULL);\r
+  }\r
+\r
+  return (FindEndOfParameter (CloseQuote+1));\r
+}\r
+\r
+/**\r
+  Return the next parameter from a command line string.\r
+\r
+  This function moves the next parameter from Walker into TempParameter and moves\r
+  Walker up past that parameter for recursive calling.  When the final parameter\r
+  is moved *Walker will be set to NULL;\r
+\r
+  Temp Parameter must be large enough to hold the parameter before calling this\r
+  function.\r
+\r
+  This will also remove all remaining ^ characters after processing.\r
+\r
+  @param[in, out] Walker          pointer to string of command line.  Adjusted to\r
+                                  reminaing command line on return\r
+  @param[in, out] TempParameter   pointer to string of command line item extracted.\r
+  @param[in]      Length          buffer size of TempParameter.\r
+  @param[in]      StripQuotation  if TRUE then strip the quotation marks surrounding\r
+                                  the parameters.\r
+\r
+  @return   EFI_INALID_PARAMETER  A required parameter was NULL or pointed to a NULL or empty string.\r
+  @return   EFI_NOT_FOUND         A closing " could not be found on the specified string\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+GetNextParameter(\r
+  IN OUT CHAR16   **Walker,\r
+  IN OUT CHAR16   **TempParameter,\r
+  IN CONST UINTN  Length,\r
+  IN BOOLEAN      StripQuotation\r
+  )\r
+{\r
+  CONST CHAR16 *NextDelim;\r
+\r
+  if (Walker           == NULL\r
+    ||*Walker          == NULL\r
+    ||TempParameter    == NULL\r
+    ||*TempParameter   == NULL\r
+    ){\r
+    return (EFI_INVALID_PARAMETER);\r
+  }\r
+\r
+\r
+  //\r
+  // make sure we dont have any leading spaces\r
+  //\r
+  while ((*Walker)[0] == L' ') {\r
+      (*Walker)++;\r
+  }\r
+\r
+  //\r
+  // make sure we still have some params now...\r
+  //\r
+  if (StrLen(*Walker) == 0) {\r
+DEBUG_CODE_BEGIN();\r
+    *Walker        = NULL;\r
+DEBUG_CODE_END();\r
+    return (EFI_INVALID_PARAMETER);\r
+  }\r
+\r
+  NextDelim = FindEndOfParameter(*Walker);\r
+\r
+  if (NextDelim == NULL){\r
+DEBUG_CODE_BEGIN();\r
+    *Walker        = NULL;\r
+DEBUG_CODE_END();\r
+    return (EFI_NOT_FOUND);\r
+  }\r
+\r
+  StrnCpyS(*TempParameter, Length / sizeof(CHAR16), (*Walker), NextDelim - *Walker);\r
+\r
+  //\r
+  // Add a CHAR_NULL if we didnt get one via the copy\r
+  //\r
+  if (*NextDelim != CHAR_NULL) {\r
+    (*TempParameter)[NextDelim - *Walker] = CHAR_NULL;\r
+  }\r
+\r
+  //\r
+  // Update Walker for the next iteration through the function\r
+  //\r
+  *Walker = (CHAR16*)NextDelim;\r
+\r
+  //\r
+  // Remove any non-escaped quotes in the string\r
+  // Remove any remaining escape characters in the string\r
+  //\r
+  for (NextDelim = FindFirstCharacter(*TempParameter, L"\"^", CHAR_NULL) \r
+    ; *NextDelim != CHAR_NULL \r
+    ; NextDelim = FindFirstCharacter(NextDelim, L"\"^", CHAR_NULL)\r
+    ) {\r
+    if (*NextDelim == L'^') {\r
+\r
+      //\r
+      // eliminate the escape ^\r
+      //\r
+      CopyMem ((CHAR16*)NextDelim, NextDelim + 1, StrSize (NextDelim + 1));\r
+      NextDelim++;\r
+    } else if (*NextDelim == L'\"') {\r
+\r
+      //\r
+      // eliminate the unescaped quote\r
+      //\r
+      if (StripQuotation) {\r
+        CopyMem ((CHAR16*)NextDelim, NextDelim + 1, StrSize (NextDelim + 1));\r
+         } else{\r
+        NextDelim++;\r
+         }\r
+    }\r
+  }\r
+\r
+  return EFI_SUCCESS;\r
+}\r
+\r
 /**\r
   Function to populate Argc and Argv.\r
 \r
@@ -82,7 +238,7 @@ ParseCommandLineToArgs(
       ; Walker != NULL && *Walker != CHAR_NULL\r
       ; Count++\r
       ) {\r
-    if (EFI_ERROR (ShellGetNextParameter (&Walker, TempParameter, Size, TRUE))) {\r
+    if (EFI_ERROR(GetNextParameter(&Walker, &TempParameter, Size, TRUE))) {\r
       break;\r
     }\r
   }\r
@@ -100,7 +256,7 @@ ParseCommandLineToArgs(
   Walker = (CHAR16*)NewCommandLine;\r
   while(Walker != NULL && *Walker != CHAR_NULL) {\r
     SetMem16(TempParameter, Size, CHAR_NULL);\r
-    if (EFI_ERROR (ShellGetNextParameter (&Walker, TempParameter, Size, StripQuotation))) {\r
+    if (EFI_ERROR(GetNextParameter(&Walker, &TempParameter, Size, StripQuotation))) {\r
       Status = EFI_INVALID_PARAMETER;\r
       goto Done;\r
     }\r
index 1205d92c197cf6f25f89fe94a4e834419572c77c..926f36242cdee50e152e33d7419a700dac6e7cf0 100644 (file)
@@ -190,5 +190,34 @@ ParseCommandLineToArgs(
   IN OUT UINTN    *Argc\r
   );\r
 \r
+/**\r
+  return the next parameter from a command line string;\r
+\r
+  This function moves the next parameter from Walker into TempParameter and moves\r
+  Walker up past that parameter for recursive calling.  When the final parameter\r
+  is moved *Walker will be set to NULL;\r
+\r
+  Temp Parameter must be large enough to hold the parameter before calling this\r
+  function.\r
+\r
+  @param[in, out] Walker          pointer to string of command line.  Adjusted to\r
+                                  reminaing command line on return\r
+  @param[in, out] TempParameter   pointer to string of command line item extracted.\r
+  @param[in]      Length          Length of (*TempParameter) in bytes\r
+  @param[in]      StripQuotation  if TRUE then strip the quotation marks surrounding\r
+                                  the parameters.\r
+\r
+  @return   EFI_INALID_PARAMETER  A required parameter was NULL or pointed to a NULL or empty string.\r
+  @return   EFI_NOT_FOUND         A closing " could not be found on the specified string\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+GetNextParameter(\r
+  IN OUT CHAR16   **Walker,\r
+  IN OUT CHAR16   **TempParameter,\r
+  IN CONST UINTN  Length,\r
+  IN BOOLEAN      StripQuotation\r
+  );\r
+\r
 #endif //_SHELL_PARAMETERS_PROTOCOL_PROVIDER_HEADER_\r
 \r
index 5c5e241f1525e03b0a8713cd0dc5a9a83508b15c..3ee820001e9e92d19da441b5424f5b5742efaee0 100644 (file)
@@ -719,49 +719,4 @@ CatSDumpHex (
   IN UINTN   DataSize,\r
   IN VOID    *UserData\r
   );\r
-\r
-/**\r
-  Return the pointer to the first occurrence of any character from a list of characters.\r
-\r
-  @param[in] String                 The string to parse\r
-  @param[in] CharacterList          The list of character to look for\r
-  @param[in] IgnoreEscapedCharacter TRUE to ignore escaped characters\r
-\r
-  @return The location of the first character in the String.\r
-  @return Pointer to the ending NULL character of the String.\r
-**/\r
-CONST CHAR16*\r
-EFIAPI\r
-ShellFindFirstCharacter (\r
-  IN CONST CHAR16  *String,\r
-  IN CONST CHAR16  *CharacterList,\r
-  IN CONST BOOLEAN IgnoreEscapedCharacter\r
-  );\r
-\r
-/**\r
-  return the next parameter from a command line string;\r
-\r
-  This function moves the next parameter from Walker into NextParameter and moves\r
-  Walker up past that parameter for recursive calling.  When the final parameter\r
-  is moved *Walker will be set to NULL;\r
-\r
-  @param[in, out] Walker          pointer to string of command line.  Adjusted to\r
-                                  reminaing command line on return\r
-  @param[in, out] NextParameter   string of command line item extracted.\r
-  @param[in]      Length          Length of TempParameter in bytes\r
-  @param[in]      StripQuotation  if TRUE then strip the quotation marks surrounding\r
-                                  the parameters.\r
-\r
-  @return   EFI_INALID_PARAMETER  A required parameter was NULL or pointed to a NULL or empty string.\r
-  @return   EFI_NOT_FOUND         A closing " could not be found on the specified string\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ShellGetNextParameter(\r
-  IN OUT CHAR16   **Walker,\r
-  IN OUT CHAR16   *NextParameter,\r
-  IN CONST UINTN  Length,\r
-  IN BOOLEAN      StripQuotation\r
-  );\r
-\r
 #endif //_SHELL_COMMAND_LIB_\r
index ac77111ef93c6630e9d53214cd1c527f09e0d989..a97361c407d479eb660be24097716ee5bb9f6e61 100644 (file)
@@ -82,191 +82,6 @@ CommandInit(
   return (EFI_SUCCESS);\r
 }\r
 \r
-/**\r
-  Return the pointer to the first occurrence of any character from a list of characters.\r
-\r
-  @param[in] String                 The string to parse\r
-  @param[in] CharacterList          The list of character to look for\r
-  @param[in] IgnoreEscapedCharacter TRUE to ignore escaped characters\r
-\r
-  @return The location of the first character in the String.\r
-  @return Pointer to the ending NULL character of the String.\r
-**/\r
-CONST CHAR16*\r
-EFIAPI\r
-ShellFindFirstCharacter (\r
-  IN CONST CHAR16  *String,\r
-  IN CONST CHAR16  *CharacterList,\r
-  IN CONST BOOLEAN IgnoreEscapedCharacter\r
-  )\r
-{\r
-  UINTN WalkChar;\r
-  UINTN WalkStr;\r
-\r
-  for (WalkStr = 0; WalkStr < StrLen (String); WalkStr++) {\r
-    if (IgnoreEscapedCharacter && (String[WalkStr] == L'^')) {\r
-      WalkStr++;\r
-      continue;\r
-    }\r
-    for (WalkChar = 0; WalkChar < StrLen (CharacterList); WalkChar++) {\r
-      if (String[WalkStr] == CharacterList[WalkChar]) {\r
-        return &String[WalkStr];\r
-      }\r
-    }\r
-  }\r
-  return &String[WalkStr];\r
-}\r
-\r
-/**\r
-  Return the next parameter's end from a command line string.\r
-\r
-  @param[in] String        the string to parse\r
-**/\r
-CONST CHAR16*\r
-FindEndOfParameter(\r
-  IN CONST CHAR16 *String\r
-  )\r
-{\r
-  CONST CHAR16 *First;\r
-  CONST CHAR16 *CloseQuote;\r
-\r
-  First = ShellFindFirstCharacter (String, L" \"", TRUE);\r
-\r
-  //\r
-  // nothing, all one parameter remaining\r
-  //\r
-  if (*First == CHAR_NULL) {\r
-    return (First);\r
-  }\r
-\r
-  //\r
-  // If space before a quote (or neither found, i.e. both CHAR_NULL),\r
-  // then that's the end.\r
-  //\r
-  if (*First == L' ') {\r
-    return (First);\r
-  }\r
-\r
-  CloseQuote = ShellFindFirstCharacter (First+1, L"\"", TRUE);\r
-\r
-  //\r
-  // We did not find a terminator...\r
-  //\r
-  if (*CloseQuote == CHAR_NULL) {\r
-    return (NULL);\r
-  }\r
-\r
-  return (FindEndOfParameter (CloseQuote+1));\r
-}\r
-\r
-/**\r
-  Return the next parameter from a command line string.\r
-\r
-  This function moves the next parameter from Walker into NextParameter and moves\r
-  Walker up past that parameter for recursive calling.  When the final parameter\r
-  is moved *Walker will be set to NULL;\r
-\r
-  This will also remove all remaining ^ characters after processing.\r
-\r
-  @param[in, out] Walker          pointer to string of command line.  Adjusted to\r
-                                  reminaing command line on return\r
-  @param[in, out] NextParameter   pointer to string of command line item extracted.\r
-  @param[in]      Length          buffer size of TempParameter.\r
-  @param[in]      StripQuotation  if TRUE then strip the quotation marks surrounding\r
-                                  the parameters.\r
-\r
-  @return   EFI_INALID_PARAMETER  A required parameter was NULL or pointed to a NULL or empty string.\r
-  @return   EFI_NOT_FOUND         A closing " could not be found on the specified string\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ShellGetNextParameter (\r
-  IN OUT CHAR16   **Walker,\r
-  IN OUT CHAR16   *NextParameter,\r
-  IN CONST UINTN  Length,\r
-  IN BOOLEAN      StripQuotation\r
-  )\r
-{\r
-  CONST CHAR16 *NextDelim;\r
-\r
-  if (Walker           == NULL\r
-    ||*Walker          == NULL\r
-    ||NextParameter    == NULL\r
-    ){\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-\r
-  //\r
-  // make sure we dont have any leading spaces\r
-  //\r
-  while ((*Walker)[0] == L' ') {\r
-    (*Walker)++;\r
-  }\r
-\r
-  //\r
-  // make sure we still have some params now...\r
-  //\r
-  if (StrLen(*Walker) == 0) {\r
-    DEBUG_CODE (\r
-      *Walker = NULL;\r
-    );\r
-    return (EFI_INVALID_PARAMETER);\r
-  }\r
-\r
-  NextDelim = FindEndOfParameter(*Walker);\r
-\r
-  if (NextDelim == NULL){\r
-    DEBUG_CODE (\r
-      *Walker = NULL;\r
-    );\r
-    return (EFI_NOT_FOUND);\r
-  }\r
-\r
-  StrnCpyS(NextParameter, Length / sizeof(CHAR16), (*Walker), NextDelim - *Walker);\r
-\r
-  //\r
-  // Add a CHAR_NULL if we didnt get one via the copy\r
-  //\r
-  if (*NextDelim != CHAR_NULL) {\r
-    NextParameter[NextDelim - *Walker] = CHAR_NULL;\r
-  }\r
-\r
-  //\r
-  // Update Walker for the next iteration through the function\r
-  //\r
-  *Walker = (CHAR16*)NextDelim;\r
-\r
-  //\r
-  // Remove any non-escaped quotes in the string\r
-  // Remove any remaining escape characters in the string\r
-  //\r
-  for (NextDelim = ShellFindFirstCharacter(NextParameter, L"\"^", FALSE)\r
-    ; *NextDelim != CHAR_NULL\r
-    ; NextDelim = ShellFindFirstCharacter(NextDelim, L"\"^", FALSE)\r
-    ) {\r
-    if (*NextDelim == L'^') {\r
-\r
-      //\r
-      // eliminate the escape ^\r
-      //\r
-      CopyMem ((CHAR16*)NextDelim, NextDelim + 1, StrSize (NextDelim + 1));\r
-      NextDelim++;\r
-    } else if (*NextDelim == L'\"') {\r
-\r
-      //\r
-      // eliminate the unescaped quote\r
-      //\r
-      if (StripQuotation) {\r
-        CopyMem ((CHAR16*)NextDelim, NextDelim + 1, StrSize (NextDelim + 1));\r
-      } else {\r
-        NextDelim++;\r
-      }\r
-    }\r
-  }\r
-\r
-  return EFI_SUCCESS;\r
-}\r
-\r
 /**\r
   Constructor for the Shell Command library.\r
 \r