Revert "ShellPkg: Move FindFirstCharacter/GetNextParameter to ShellCommandLib"

This reverts commit c0bcd3433f.
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>
This commit is contained in:
Ruiyu Ni
2016-08-23 10:40:55 +08:00
parent a747bc1eec
commit 1219c85df4
6 changed files with 258 additions and 260 deletions

View File

@@ -370,6 +370,24 @@ RunScriptFile (
IN EFI_SHELL_PARAMETERS_PROTOCOL *ParamProtocol
);
/**
Return the pointer to the first occurrence of any character from a list of characters.
@param[in] String the string to parse
@param[in] CharacterList the list of character to look for
@param[in] EscapeCharacter An escape character to skip
@return the location of the first character in the string
@retval CHAR_NULL no instance of any character in CharacterList was found in String
**/
CONST CHAR16*
EFIAPI
FindFirstCharacter(
IN CONST CHAR16 *String,
IN CONST CHAR16 *CharacterList,
IN CONST CHAR16 EscapeCharacter
);
/**
Cleans off leading and trailing spaces and tabs.