MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / ContainsSplit

Function ContainsSplit

ShellPkg/Application/Shell/Shell.c:205–245  ·  view source on GitHub ↗

Determine if a command line contains a split operation @param[in] CmdLine The command line to parse. @retval TRUE CmdLine has a valid split. @retval FALSE CmdLine does not have a valid split. **/

Source from the content-addressed store, hash-verified

203 @retval FALSE CmdLine does not have a valid split.
204**/
205BOOLEAN
206ContainsSplit(
207 IN CONST CHAR16 *CmdLine
208 )
209{
210 CONST CHAR16 *TempSpot;
211 CONST CHAR16 *FirstQuote;
212 CONST CHAR16 *SecondQuote;
213
214 FirstQuote = FindNextInstance (CmdLine, L"\"", TRUE);
215 SecondQuote = NULL;
216 TempSpot = FindFirstCharacter(CmdLine, L"|", L'^');
217
218 if (FirstQuote == NULL ||
219 TempSpot == NULL ||
220 TempSpot == CHAR_NULL ||
221 FirstQuote > TempSpot
222 ) {
223 return (BOOLEAN) ((TempSpot != NULL) && (*TempSpot != CHAR_NULL));
224 }
225
226 while ((TempSpot != NULL) && (*TempSpot != CHAR_NULL)) {
227 if (FirstQuote == NULL || FirstQuote > TempSpot) {
228 break;
229 }
230 SecondQuote = FindNextInstance (FirstQuote + 1, L"\"", TRUE);
231 if (SecondQuote == NULL) {
232 break;
233 }
234 if (SecondQuote < TempSpot) {
235 FirstQuote = FindNextInstance (SecondQuote + 1, L"\"", TRUE);
236 continue;
237 } else {
238 FirstQuote = FindNextInstance (SecondQuote + 1, L"\"", TRUE);
239 TempSpot = FindFirstCharacter(TempSpot + 1, L"|", L'^');
240 continue;
241 }
242 }
243
244 return (BOOLEAN) ((TempSpot != NULL) && (*TempSpot != CHAR_NULL));
245}
246
247/**
248 Function to start monitoring for CTRL-S using SimpleTextInputEx. This

Callers 2

VerifySplitFunction · 0.85
RunShellCommandFunction · 0.85

Calls 2

FindNextInstanceFunction · 0.85
FindFirstCharacterFunction · 0.85

Tested by

no test coverage detected