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

@ -190,5 +190,34 @@ ParseCommandLineToArgs(
IN OUT UINTN *Argc
);
/**
return the next parameter from a command line string;
This function moves the next parameter from Walker into TempParameter and moves
Walker up past that parameter for recursive calling. When the final parameter
is moved *Walker will be set to NULL;
Temp Parameter must be large enough to hold the parameter before calling this
function.
@param[in, out] Walker pointer to string of command line. Adjusted to
reminaing command line on return
@param[in, out] TempParameter pointer to string of command line item extracted.
@param[in] Length Length of (*TempParameter) in bytes
@param[in] StripQuotation if TRUE then strip the quotation marks surrounding
the parameters.
@return EFI_INALID_PARAMETER A required parameter was NULL or pointed to a NULL or empty string.
@return EFI_NOT_FOUND A closing " could not be found on the specified string
**/
EFI_STATUS
EFIAPI
GetNextParameter(
IN OUT CHAR16 **Walker,
IN OUT CHAR16 **TempParameter,
IN CONST UINTN Length,
IN BOOLEAN StripQuotation
);
#endif //_SHELL_PARAMETERS_PROTOCOL_PROVIDER_HEADER_