26 if ((Number ==
NULL) || (*Number == CHAR_NULL)) {
30 if (*Number == L
'-') {
34 if (
StrLen (Number) == 0) {
38 if (
StrLen (Number) >= 7) {
71 if (!gEfiShellProtocol->BatchIsActive ()) {
76 if (gEfiShellParametersProtocol->
Argc > 1) {
90 gShellLevel1HiiHandle,
93 CurrentScriptFile !=
NULL
108 CHAR16 *ReplacementName;
109 CHAR16 *CurrentValue;
110 BOOLEAN RemoveSubstAlias;
113#define SIZE_OF_SHELL_FOR_INFO OFFSET_OF (SHELL_FOR_INFO, Set)
114#define SHELL_FOR_INFO_SIGNATURE SIGNATURE_32 ('S', 'F', 'I', 's')
129 IN CONST CHAR16 *CommandString,
139 ASSERT (Alias !=
NULL);
145 ; !
IsNull (List, &Node->Link)
149 ASSERT (Node->CommandString !=
NULL);
150 ASSERT (Node->Alias !=
NULL);
151 if (
StrCmp (Node->Alias, Alias) == 0) {
153 Node->CommandString =
NULL;
154 Node->CommandString =
StrnCatGrow (&Node->CommandString,
NULL, CommandString, 0);
163 return (EFI_OUT_OF_RESOURCES);
166 ASSERT (Node->Alias ==
NULL);
168 ASSERT (Node->CommandString ==
NULL);
169 Node->CommandString =
StrnCatGrow (&Node->CommandString,
NULL, CommandString, 0);
196 ASSERT (Alias !=
NULL);
202 ; !
IsNull (List, &Node->Link)
206 ASSERT (Node->CommandString !=
NULL);
207 ASSERT (Node->Alias !=
NULL);
208 if (
StrCmp (Node->Alias, Alias) == 0) {
233 ASSERT (Alias !=
NULL);
239 ; !
IsNull (List, &Node->Link)
243 ASSERT (Node->CommandString !=
NULL);
244 ASSERT (Node->Alias !=
NULL);
245 if (
StrCmp (Node->Alias, Alias) == 0) {
274 return ((
UINTN)RetVal);
277 return ((
UINTN)(-1));
297 CHAR16 *ArgSetWalker;
326 if (!gEfiShellProtocol->BatchIsActive ()) {
331 if (gEfiShellParametersProtocol->
Argc < 4) {
337 if (CurrentScriptFile ==
NULL) {
338 ASSERT (CurrentScriptFile !=
NULL);
354 gShellLevel1HiiHandle,
365 if ( (gEfiShellParametersProtocol->
Argv[1][0] != L
'%') || (gEfiShellParametersProtocol->
Argv[1][2] != CHAR_NULL)
366 || !( ((gEfiShellParametersProtocol->
Argv[1][1] >= L
'a') && (gEfiShellParametersProtocol->
Argv[1][1] <= L
'z'))
367 || ((gEfiShellParametersProtocol->
Argv[1][1] >= L
'A') && (gEfiShellParametersProtocol->
Argv[1][1] <= L
'Z')))
374 if (gUnicodeCollation->StriColl (
377 gEfiShellParametersProtocol->
Argv[2]
380 for (LoopVar = 0x3; LoopVar < gEfiShellParametersProtocol->
Argc; LoopVar++) {
381 ASSERT ((ArgSet ==
NULL && ArgSize == 0) || (ArgSet !=
NULL));
382 if ( (
StrStr (gEfiShellParametersProtocol->
Argv[LoopVar], L
"*") !=
NULL)
383 || (
StrStr (gEfiShellParametersProtocol->
Argv[LoopVar], L
"?") !=
NULL)
384 || (
StrStr (gEfiShellParametersProtocol->
Argv[LoopVar], L
"[") !=
NULL)
385 || (
StrStr (gEfiShellParametersProtocol->
Argv[LoopVar], L
"]") !=
NULL))
388 Status =
ShellOpenFileMetaArg ((CHAR16 *)gEfiShellParametersProtocol->
Argv[LoopVar], EFI_FILE_MODE_READ, &FileList);
390 ArgSet =
StrnCatGrow (&ArgSet, &ArgSize, L
" \"", 0);
391 ArgSet =
StrnCatGrow (&ArgSet, &ArgSize, gEfiShellParametersProtocol->
Argv[LoopVar], 0);
392 ArgSet =
StrnCatGrow (&ArgSet, &ArgSize, L
"\"", 0);
399 ArgSet =
StrnCatGrow (&ArgSet, &ArgSize, L
" \"", 0);
401 ArgSet =
StrnCatGrow (&ArgSet, &ArgSize, L
"\"", 0);
407 Parameter = gEfiShellParametersProtocol->
Argv[LoopVar];
408 if ((Parameter[0] == L
'\"') && (Parameter[
StrLen (Parameter)-1] == L
'\"')) {
410 ArgSet =
StrnCatGrow (&ArgSet, &ArgSize, Parameter, 0);
412 ArgSet =
StrnCatGrow (&ArgSet, &ArgSize, L
" \"", 0);
413 ArgSet =
StrnCatGrow (&ArgSet, &ArgSize, Parameter, 0);
414 ArgSet =
StrnCatGrow (&ArgSet, &ArgSize, L
"\"", 0);
419 if (ArgSet ==
NULL) {
433 Info->Signature = SHELL_FOR_INFO_SIGNATURE;
435 NewSize =
StrSize (gEfiShellParametersProtocol->
Argv[1]);
436 CopyMem (Info->Set+(
StrSize (ArgSet)/
sizeof (Info->Set[0])), gEfiShellParametersProtocol->
Argv[1], NewSize);
437 Info->ReplacementName = Info->Set+
StrSize (ArgSet)/
sizeof (Info->Set[0]);
438 Info->CurrentValue = (CHAR16 *)Info->Set;
444 Info->RemoveSubstAlias =
FALSE;
446 Info->RemoveSubstAlias =
TRUE;
451 }
else if (gUnicodeCollation->StriColl (
454 gEfiShellParametersProtocol->
Argv[2]
457 for (LoopVar = 0x3; LoopVar < gEfiShellParametersProtocol->
Argc; LoopVar++) {
458 ASSERT ((ArgSet ==
NULL && ArgSize == 0) || (ArgSet !=
NULL));
459 if ((
StrStr (gEfiShellParametersProtocol->
Argv[LoopVar], L
")") !=
NULL) &&
460 ((LoopVar + 1) < gEfiShellParametersProtocol->
Argc)
466 if (ArgSet ==
NULL) {
472 ArgSet =
StrnCatGrow (&ArgSet, &ArgSize, gEfiShellParametersProtocol->
Argv[LoopVar], 0);
476 if (ArgSet ==
NULL) {
488 Info->Signature = SHELL_FOR_INFO_SIGNATURE;
489 CopyMem (Info->Set, gEfiShellParametersProtocol->
Argv[1],
StrSize (gEfiShellParametersProtocol->
Argv[1]));
490 Info->ReplacementName = Info->Set;
491 Info->CurrentValue =
NULL;
492 ArgSetWalker = ArgSet;
493 if (ArgSetWalker[0] != L
'(') {
499 gShellLevel1HiiHandle,
505 TempSpot =
StrStr (ArgSetWalker, L
")");
506 if (TempSpot !=
NULL) {
507 TempString = TempSpot+1;
508 if (*(TempString) != CHAR_NULL) {
509 while (TempString !=
NULL && *TempString == L
' ') {
513 if (
StrLen (TempString) > 0) {
519 if (TempSpot ==
NULL) {
525 gShellLevel1HiiHandle,
530 *TempSpot = CHAR_NULL;
532 while (ArgSetWalker !=
NULL && ArgSetWalker[0] == L
' ') {
542 gShellLevel1HiiHandle,
548 if (ArgSetWalker[0] == L
'-') {
554 ArgSetWalker =
StrStr (ArgSetWalker, L
" ");
555 while (ArgSetWalker !=
NULL && ArgSetWalker[0] == L
' ') {
565 gShellLevel1HiiHandle,
571 if (ArgSetWalker[0] == L
'-') {
577 if (Info->Current < Info->End) {
583 ArgSetWalker =
StrStr (ArgSetWalker, L
" ");
584 while (ArgSetWalker !=
NULL && ArgSetWalker[0] == L
' ') {
588 if ((ArgSetWalker !=
NULL) && (*ArgSetWalker != CHAR_NULL)) {
595 gShellLevel1HiiHandle,
601 if (*ArgSetWalker == L
')') {
602 ASSERT (Info->Step == 1 || Info->Step == -1);
604 if (ArgSetWalker[0] == L
'-') {
616 gShellLevel1HiiHandle,
632 Info->RemoveSubstAlias =
FALSE;
634 Info->RemoveSubstAlias =
TRUE;
648 gShellLevel1HiiHandle,
650 CurrentScriptFile !=
NULL
660 ASSERT (ArgSetWalker ==
NULL);
661 ASSERT (ArgSet ==
NULL);
668 Info->CurrentValue = (CHAR16 *)Info->Set;
680 ASSERT (Info !=
NULL);
681 if (Info->Step != 0) {
689 Info->Current += Info->Step;
693 if (TempString ==
NULL) {
694 SHELL_FREE_NON_NULL (ArgSet);
695 SHELL_FREE_NON_NULL (Info);
699 UnicodeSPrint (TempString, 50*
sizeof (CHAR16), L
"%d", Info->Current);
703 if (((Info->Step > 0) && (Info->Current > Info->End)) || ((Info->Step < 0) && (Info->Current < Info->End))) {
714 gShellLevel1HiiHandle,
717 CurrentScriptFile !=
NULL
724 if (Info->RemoveSubstAlias) {
737 ASSERT (Info->Set !=
NULL);
738 if ((Info->CurrentValue !=
NULL) && (*Info->CurrentValue != CHAR_NULL)) {
739 if (Info->CurrentValue[0] == L
' ') {
740 Info->CurrentValue++;
743 if (Info->CurrentValue[0] == L
'\"') {
744 Info->CurrentValue++;
750 ASSERT (TempString ==
NULL);
752 if (TempString ==
NULL) {
755 TempSpot =
StrStr (TempString, L
"\" \"");
756 if (TempSpot !=
NULL) {
757 *TempSpot = CHAR_NULL;
760 while (TempString[
StrLen (TempString)-1] == L
'\"') {
761 TempString[
StrLen (TempString)-1] = CHAR_NULL;
765 Info->CurrentValue +=
StrLen (TempString);
767 if (Info->CurrentValue[0] == L
'\"') {
768 Info->CurrentValue++;
784 gShellLevel1HiiHandle,
787 CurrentScriptFile !=
NULL
794 if (Info->RemoveSubstAlias) {
806 if (ArgSet !=
NULL) {
810 return (ShellStatus);
BOOLEAN EFIAPI IsNull(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
LIST_ENTRY *EFIAPI GetPreviousNode(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
UINTN EFIAPI StrSize(IN CONST CHAR16 *String)
BOOLEAN EFIAPI IsListEmpty(IN CONST LIST_ENTRY *ListHead)
LIST_ENTRY *EFIAPI GetNextNode(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
INTN EFIAPI StrCmp(IN CONST CHAR16 *FirstString, IN CONST CHAR16 *SecondString)
LIST_ENTRY *EFIAPI GetFirstNode(IN CONST LIST_ENTRY *List)
LIST_ENTRY *EFIAPI RemoveEntryList(IN CONST LIST_ENTRY *Entry)
UINTN EFIAPI StrLen(IN CONST CHAR16 *String)
CHAR16 *EFIAPI StrStr(IN CONST CHAR16 *String, IN CONST CHAR16 *SearchString)
LIST_ENTRY *EFIAPI InsertTailList(IN OUT LIST_ENTRY *ListHead, IN OUT LIST_ENTRY *Entry)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
BOOLEAN ShellIsValidForNumber(IN CONST CHAR16 *Number)
UINTN ReturnUintn(IN CONST CHAR16 *String)
BOOLEAN InternalIsAliasOnList(IN CONST CHAR16 *Alias, IN CONST LIST_ENTRY *List)
SHELL_STATUS EFIAPI ShellCommandRunEndFor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
EFI_STATUS InternalUpdateAliasOnList(IN CONST CHAR16 *Alias, IN CONST CHAR16 *CommandString, IN OUT LIST_ENTRY *List)
SHELL_STATUS EFIAPI ShellCommandRunFor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
BOOLEAN InternalRemoveAliasFromList(IN CONST CHAR16 *Alias, IN OUT LIST_ENTRY *List)
UINTN EFIAPI UnicodeSPrint(OUT CHAR16 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR16 *FormatString,...)
#define ASSERT_EFI_ERROR(StatusParameter)
@ SHELL_INVALID_PARAMETER
EFI_STATUS EFIAPI Set(IN EMBEDDED_GPIO *This, IN EMBEDDED_GPIO_PIN Gpio, IN EMBEDDED_GPIO_MODE Mode)
EFI_STATUS EFIAPI CommandInit(VOID)
SCRIPT_FILE *EFIAPI ShellCommandGetCurrentScriptFile(VOID)
EFI_STATUS EFIAPI ShellCloseFileMetaArg(IN OUT EFI_SHELL_FILE_INFO **ListHead)
EFI_STATUS EFIAPI ShellPrintHiiEx(IN INT32 Col OPTIONAL, IN INT32 Row OPTIONAL, IN CONST CHAR8 *Language OPTIONAL, IN CONST EFI_STRING_ID HiiFormatStringId, IN CONST EFI_HII_HANDLE HiiFormatHandle,...)
BOOLEAN EFIAPI ShellIsDecimalDigitCharacter(IN CHAR16 Char)
CHAR16 *EFIAPI StrnCatGrow(IN OUT CHAR16 **Destination, IN OUT UINTN *CurrentSize, IN CONST CHAR16 *Source, IN UINTN Count)
EFI_STATUS EFIAPI ShellOpenFileMetaArg(IN CHAR16 *Arg, IN UINT64 OpenMode, IN OUT EFI_SHELL_FILE_INFO **ListHead)
EFI_STATUS EFIAPI ShellInitialize(VOID)
EFI_STATUS EFIAPI ShellConvertStringToUint64(IN CONST CHAR16 *String, OUT UINT64 *Value, IN CONST BOOLEAN ForceHex, IN CONST BOOLEAN StopAtSpace)
BOOLEAN MoveToTag(IN CONST LIST_MANIP_FUNC Function, IN CONST CHAR16 *DecrementerTag, IN CONST CHAR16 *IncrementerTag, IN CONST CHAR16 *Label OPTIONAL, IN OUT SCRIPT_FILE *ScriptFile, IN CONST BOOLEAN MovePast, IN CONST BOOLEAN FindOnly, IN CONST BOOLEAN WrapAroundScript)
LIST_ENTRY Link
Linked list members.
CONST CHAR16 * FullName
Fully qualified filename.
VOID * Data
The data structure format dependant upon Command. (not always used)
UINTN Line
What line of the script file this was on.
BOOLEAN Reset
Reset the command (it must be treated like a initial run (but it may have data already))
SCRIPT_COMMAND_LIST * CurrentCommand
The command currently being operated. If !=NULL must be a member of CommandList.
LIST_ENTRY SubstList
A list of current script loop alias' (ALIAS_LIST objects) (Used for the for %-based replacement).