+ else if (UnicodeCollation->StriColl (\r
+ UnicodeCollation,\r
+ L"-noversion",\r
+ CurrentArg\r
+ ) == 0) {\r
+ ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoVersion = TRUE;\r
+ }\r
+ else if (UnicodeCollation->StriColl (\r
+ UnicodeCollation,\r
+ L"-nonest",\r
+ CurrentArg\r
+ ) == 0) {\r
+ ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoNest = TRUE;\r
+ }\r
+ else if (UnicodeCollation->StriColl (\r
+ UnicodeCollation,\r
+ L"-delay",\r
+ CurrentArg\r
+ ) == 0) {\r
+ ShellInfoObject.ShellInitSettings.BitUnion.Bits.Delay = TRUE;\r
+ // Check for optional delay value following "-delay"\r
+ DelayValueStr = gEfiShellParametersProtocol->Argv[LoopVar + 1];\r
+ if (DelayValueStr != NULL){\r
+ if (*DelayValueStr == L':') {\r
+ DelayValueStr++;\r
+ }\r
+ if (!EFI_ERROR(ShellConvertStringToUint64 (\r
+ DelayValueStr,\r
+ &DelayValue,\r
+ FALSE,\r
+ FALSE\r
+ ))) {\r
+ ShellInfoObject.ShellInitSettings.Delay = (UINTN)DelayValue;\r
+ LoopVar++;\r
+ }\r
+ }\r
+ } else if (UnicodeCollation->StriColl (\r
+ UnicodeCollation,\r
+ L"-exit",\r
+ CurrentArg\r
+ ) == 0) {\r
+ ShellInfoObject.ShellInitSettings.BitUnion.Bits.Exit = TRUE;\r
+ } else if (StrnCmp (L"-", CurrentArg, 1) == 0) {\r
+ // Unrecognized option\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_GEN_PROBLEM),\r
+ ShellInfoObject.HiiHandle,\r
+ CurrentArg\r
+ );\r
+ return EFI_INVALID_PARAMETER;\r
+ } else {\r
+ //\r
+ // First argument should be Shell.efi image name\r
+ //\r
+ if (LoopVar == 0) {\r
+ continue;\r
+ }\r
+\r
+ ShellInfoObject.ShellInitSettings.FileName = NULL;\r
+ Size = 0;\r
+ //\r
+ // If first argument contains a space, then add double quotes before the argument\r
+ //\r
+ if (StrStr (CurrentArg, L" ") != NULL) {\r
+ StrnCatGrow(&ShellInfoObject.ShellInitSettings.FileName, &Size, L"\"", 0);\r
+ if (ShellInfoObject.ShellInitSettings.FileName == NULL) {\r
+ return (EFI_OUT_OF_RESOURCES);\r
+ }\r
+ }\r
+ StrnCatGrow(&ShellInfoObject.ShellInitSettings.FileName, &Size, CurrentArg, 0);\r
+ if (ShellInfoObject.ShellInitSettings.FileName == NULL) {\r
+ return (EFI_OUT_OF_RESOURCES);\r
+ }\r
+ //\r
+ // If first argument contains a space, then add double quotes after the argument\r
+ //\r
+ if (StrStr (CurrentArg, L" ") != NULL) {\r
+ StrnCatGrow(&ShellInfoObject.ShellInitSettings.FileName, &Size, L"\"", 0);\r
+ if (ShellInfoObject.ShellInitSettings.FileName == NULL) {\r
+ return (EFI_OUT_OF_RESOURCES);\r
+ }\r
+ }\r
+ //\r
+ // We found `file-name`.\r
+ //\r
+ ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoStartup = 1;\r
+ LoopVar++;\r
+\r
+ // Add `file-name-options`\r
+ for (Size = 0 ; LoopVar < gEfiShellParametersProtocol->Argc ; LoopVar++) {\r
+ ASSERT((ShellInfoObject.ShellInitSettings.FileOptions == NULL && Size == 0) || (ShellInfoObject.ShellInitSettings.FileOptions != NULL));\r
+ //\r
+ // Add a space between arguments\r
+ //\r
+ if (ShellInfoObject.ShellInitSettings.FileOptions != NULL) {\r
+ StrnCatGrow(&ShellInfoObject.ShellInitSettings.FileOptions, &Size, L" ", 0);\r
+ if (ShellInfoObject.ShellInitSettings.FileOptions == NULL) {\r
+ SHELL_FREE_NON_NULL(ShellInfoObject.ShellInitSettings.FileName);\r
+ return (EFI_OUT_OF_RESOURCES);\r
+ }\r
+ }\r