summaryrefslogtreecommitdiff
path: root/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
diff options
context:
space:
mode:
Diffstat (limited to 'ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c')
-rw-r--r--ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c185
1 files changed, 0 insertions, 185 deletions
diff --git a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
index ac77111ef9..a97361c407 100644
--- a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
+++ b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
@@ -83,191 +83,6 @@ CommandInit(
}
/**
- 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] IgnoreEscapedCharacter TRUE to ignore escaped characters
-
- @return The location of the first character in the String.
- @return Pointer to the ending NULL character of the String.
-**/
-CONST CHAR16*
-EFIAPI
-ShellFindFirstCharacter (
- IN CONST CHAR16 *String,
- IN CONST CHAR16 *CharacterList,
- IN CONST BOOLEAN IgnoreEscapedCharacter
- )
-{
- UINTN WalkChar;
- UINTN WalkStr;
-
- for (WalkStr = 0; WalkStr < StrLen (String); WalkStr++) {
- if (IgnoreEscapedCharacter && (String[WalkStr] == L'^')) {
- WalkStr++;
- continue;
- }
- for (WalkChar = 0; WalkChar < StrLen (CharacterList); WalkChar++) {
- if (String[WalkStr] == CharacterList[WalkChar]) {
- return &String[WalkStr];
- }
- }
- }
- return &String[WalkStr];
-}
-
-/**
- Return the next parameter's end from a command line string.
-
- @param[in] String the string to parse
-**/
-CONST CHAR16*
-FindEndOfParameter(
- IN CONST CHAR16 *String
- )
-{
- CONST CHAR16 *First;
- CONST CHAR16 *CloseQuote;
-
- First = ShellFindFirstCharacter (String, L" \"", TRUE);
-
- //
- // nothing, all one parameter remaining
- //
- if (*First == CHAR_NULL) {
- return (First);
- }
-
- //
- // If space before a quote (or neither found, i.e. both CHAR_NULL),
- // then that's the end.
- //
- if (*First == L' ') {
- return (First);
- }
-
- CloseQuote = ShellFindFirstCharacter (First+1, L"\"", TRUE);
-
- //
- // We did not find a terminator...
- //
- if (*CloseQuote == CHAR_NULL) {
- return (NULL);
- }
-
- return (FindEndOfParameter (CloseQuote+1));
-}
-
-/**
- Return the next parameter from a command line string.
-
- This function moves the next parameter from Walker into NextParameter and moves
- Walker up past that parameter for recursive calling. When the final parameter
- is moved *Walker will be set to NULL;
-
- This will also remove all remaining ^ characters after processing.
-
- @param[in, out] Walker pointer to string of command line. Adjusted to
- reminaing command line on return
- @param[in, out] NextParameter pointer to string of command line item extracted.
- @param[in] Length buffer size of TempParameter.
- @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
-ShellGetNextParameter (
- IN OUT CHAR16 **Walker,
- IN OUT CHAR16 *NextParameter,
- IN CONST UINTN Length,
- IN BOOLEAN StripQuotation
- )
-{
- CONST CHAR16 *NextDelim;
-
- if (Walker == NULL
- ||*Walker == NULL
- ||NextParameter == NULL
- ){
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // make sure we dont have any leading spaces
- //
- while ((*Walker)[0] == L' ') {
- (*Walker)++;
- }
-
- //
- // make sure we still have some params now...
- //
- if (StrLen(*Walker) == 0) {
- DEBUG_CODE (
- *Walker = NULL;
- );
- return (EFI_INVALID_PARAMETER);
- }
-
- NextDelim = FindEndOfParameter(*Walker);
-
- if (NextDelim == NULL){
- DEBUG_CODE (
- *Walker = NULL;
- );
- return (EFI_NOT_FOUND);
- }
-
- StrnCpyS(NextParameter, Length / sizeof(CHAR16), (*Walker), NextDelim - *Walker);
-
- //
- // Add a CHAR_NULL if we didnt get one via the copy
- //
- if (*NextDelim != CHAR_NULL) {
- NextParameter[NextDelim - *Walker] = CHAR_NULL;
- }
-
- //
- // Update Walker for the next iteration through the function
- //
- *Walker = (CHAR16*)NextDelim;
-
- //
- // Remove any non-escaped quotes in the string
- // Remove any remaining escape characters in the string
- //
- for (NextDelim = ShellFindFirstCharacter(NextParameter, L"\"^", FALSE)
- ; *NextDelim != CHAR_NULL
- ; NextDelim = ShellFindFirstCharacter(NextDelim, L"\"^", FALSE)
- ) {
- if (*NextDelim == L'^') {
-
- //
- // eliminate the escape ^
- //
- CopyMem ((CHAR16*)NextDelim, NextDelim + 1, StrSize (NextDelim + 1));
- NextDelim++;
- } else if (*NextDelim == L'\"') {
-
- //
- // eliminate the unescaped quote
- //
- if (StripQuotation) {
- CopyMem ((CHAR16*)NextDelim, NextDelim + 1, StrSize (NextDelim + 1));
- } else {
- NextDelim++;
- }
- }
- }
-
- return EFI_SUCCESS;
-}
-
-/**
Constructor for the Shell Command library.
Initialize the library and determine if the underlying is a UEFI Shell 2.0 or an EFI shell.