return (EFI_SUCCESS);\r
}\r
\r
-/**\r
- Parse for the next instance of one string within another string. Can optionally make sure that \r
- the string was not escaped (^ character) per the shell specification.\r
-\r
- @param[in] SourceString The string to search within\r
- @param[in] FindString The string to look for\r
- @param[in] CheckForEscapeCharacter TRUE to skip escaped instances of FinfString, otherwise will return even escaped instances\r
-**/\r
-CHAR16*\r
-EFIAPI\r
-FindNextInstance(\r
- IN CONST CHAR16 *SourceString,\r
- IN CONST CHAR16 *FindString,\r
- IN CONST BOOLEAN CheckForEscapeCharacter\r
- )\r
-{\r
- CHAR16 *Temp;\r
- if (SourceString == NULL) {\r
- return (NULL);\r
- }\r
- Temp = StrStr(SourceString, FindString);\r
-\r
- //\r
- // If nothing found, or we dont care about escape characters\r
- //\r
- if (Temp == NULL || !CheckForEscapeCharacter) {\r
- return (Temp);\r
- }\r
-\r
- //\r
- // If we found an escaped character, try again on the remainder of the string\r
- //\r
- if ((Temp > (SourceString)) && *(Temp-1) == L'^') {\r
- return FindNextInstance(Temp+1, FindString, CheckForEscapeCharacter);\r
- }\r
-\r
- //\r
- // we found the right character\r
- //\r
- return (Temp);\r
-}\r
-\r
/**\r
Check whether the string between a pair of % is a valid envifronment variable name.\r
\r
CONST CHAR16 *FirstQuote;\r
CONST CHAR16 *SecondQuote;\r
\r
- FirstQuote = FindNextInstance (CmdLine, L"\"", TRUE);\r
+ FirstQuote = FindFirstCharacter (CmdLine, L"\"", L'^');\r
SecondQuote = NULL;\r
TempSpot = FindFirstCharacter(CmdLine, L"|", L'^');\r
\r
if (FirstQuote == NULL || FirstQuote > TempSpot) {\r
break;\r
} \r
- SecondQuote = FindNextInstance (FirstQuote + 1, L"\"", TRUE);\r
+ SecondQuote = FindFirstCharacter (FirstQuote + 1, L"\"", L'^');\r
if (SecondQuote == NULL) {\r
break;\r
}\r
if (SecondQuote < TempSpot) {\r
- FirstQuote = FindNextInstance (SecondQuote + 1, L"\"", TRUE);\r
+ FirstQuote = FindFirstCharacter (SecondQuote + 1, L"\"", L'^');\r
continue;\r
} else {\r
- FirstQuote = FindNextInstance (SecondQuote + 1, L"\"", TRUE);\r
+ FirstQuote = FindFirstCharacter (SecondQuote + 1, L"\"", L'^');\r
TempSpot = FindFirstCharacter(TempSpot + 1, L"|", L'^');\r
continue;\r
} \r
CHAR16 *CurrentLocator;\r
\r
for (CurrentLocator = CmdLine ; CurrentLocator != NULL ; ) {\r
- FirstQuote = FindNextInstance(CurrentLocator, L"\"", TRUE);\r
- FirstPercent = FindNextInstance(CurrentLocator, L"%", TRUE);\r
- SecondPercent = FirstPercent!=NULL?FindNextInstance(FirstPercent+1, L"%", TRUE):NULL;\r
+ FirstQuote = FindFirstCharacter(CurrentLocator, L"\"", L'^');\r
+ FirstPercent = FindFirstCharacter(CurrentLocator, L"%", L'^');\r
+ SecondPercent = FirstPercent!=NULL?FindFirstCharacter(FirstPercent+1, L"%", L'^'):NULL;\r
if (FirstPercent == NULL || SecondPercent == NULL) {\r
//\r
// If we ever dont have 2 % we are done.\r
}\r
\r
if (FirstQuote!= NULL && FirstQuote < FirstPercent) {\r
- SecondQuote = FindNextInstance(FirstQuote+1, L"\"", TRUE);\r
+ SecondQuote = FindFirstCharacter(FirstQuote+1, L"\"", L'^');\r
//\r
// Quote is first found\r
//\r
-\r
if (SecondQuote < FirstPercent) {\r
//\r
// restart after the pair of "\r