/** @file
This is THE shell (application)
Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "Shell.h"
//
// Initialize the global structure
//
NULL,
NULL,
{
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
NULL,
},
{0,0},
{
{0,0},
0,
0,
},
NULL,
0,
NULL,
NULL,
NULL,
NULL,
NULL,
{0,0},
NULL,
NULL,
NULL,
NULL,
};
/**
Function to start monitoring for CTRL-S using SimpleTextInputEx. This
feature's enabled state was not known when the shell initially launched.
@retval EFI_SUCCESS The feature is enabled.
@retval EFI_OUT_OF_RESOURCES There is not enough mnemory available.
**/
)
{
NULL,
-1,
-1,
NULL,
return (EFI_SUCCESS);
}
&KeyData,
&KeyData,
}
&KeyData,
}
&KeyData,
}
return (Status);
}
/**
The entry point for the application.
@param[in] ImageHandle The firmware allocated handle for the EFI image.
@param[in] SystemTable A pointer to the EFI System Table.
@retval EFI_SUCCESS The entry point is executed successfully.
@retval other Some error occurs when executing this entry point.
**/
UefiMain (
)
{
return (EFI_UNSUPPORTED);
}
//
// Clear the screen
//
return (Status);
}
//
// Populate the global structure from PCDs
//
//
// verify we dont allow for spec violation
//
//
// Initialize the LIST ENTRY objects...
//
//
// Check PCDs for optional features that are not implemented yet.
//
) {
return (EFI_UNSUPPORTED);
}
//
// turn off the watchdog timer
//
//
// install our console logger. This will keep a log of the output for back-browsing
//
//
// Enable the cursor to be visible
//
//
// If supporting EFI 1.1 we need to install HII protocol
// only do this if PcdShellRequireHiiPlatform == FALSE
//
// remove EFI_UNSUPPORTED check above when complete.
///@todo add support for Framework HII
//
// install our (solitary) HII package
//
///@todo Add our package into Framework HII
}
return (EFI_NOT_STARTED);
}
}
//
// create and install the EfiShellParametersProtocol
//
Status = CreatePopulateInstallShellParametersProtocol(&ShellInfoObject.NewShellParametersProtocol, &ShellInfoObject.RootShellInstance);
//
// create and install the EfiShellProtocol
//
//
// Now initialize the shell library (it requires Shell Parameters protocol)
//
Status = ShellInitialize();
Status = CommandInit();
//
// Check the command line
//
Status = ProcessCommandLine();
//
// If shell support level is >= 1 create the mappings and paths
//
}
//
// save the device path for the loaded image and the device path for the filepath (under loaded image)
// These are where to look for the startup.nsh file
//
Status = GetDevicePathsForImageAndFile(&ShellInfoObject.ImageDevPath, &ShellInfoObject.FileDevPath);
//
// Display the version
//
0,
NULL,
);
}
//
// Display the mapping
//
}
//
// init all the built in alias'
//
Status = SetBuiltInAlias();
//
// Initialize environment variables
//
if (ShellCommandGetProfileList() != NULL) {
}
Size = 100;
UnicodeSPrint(TempString, Size, L"%d.%d", ShellInfoObject.NewEfiShellProtocol->MajorVersion, ShellInfoObject.NewEfiShellProtocol->MinorVersion);
UnicodeSPrint(TempString, Size, L"%d.%d", (gST->Hdr.Revision & 0xFFFF0000) >> 16, gST->Hdr.Revision & 0x0000FFFF);
//
// Set up the event for CTRL-C monitoring...
//
}
//
// Set up the event for CTRL-S monitoring...
//
}
//
// close off the gST->ConIn
//
gST->ConIn = CreateSimpleTextInOnFile((SHELL_FILE_HANDLE)&FileInterfaceNulFile, &gST->ConsoleInHandle);
} else {
ConInHandle = NULL;
}
//
// process the startup script or launch the called app.
//
}
if (!ShellCommandGetExit() && (PcdGet8(PcdShellSupportLevel) >= 3 || PcdGetBool(PcdShellForceConsole)) && !EFI_ERROR(Status) && !ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleIn) {
//
// begin the UI waiting loop
//
do {
//
// clean out all the memory allocated for CONST <something> * return values
// between each shell prompt presentation
//
}
//
// Reset page break back to default.
//
//
// Reset the CTRL-C event (yes we ignore the return values)
//
//
// Display Prompt
//
Status = DoShellPrompt();
} while (!ShellCommandGetExit());
}
}
}
}
//
// uninstall protocols / free memory / etc...
//
}
}
}
}
}
}
}
}
}
}
}
}
}
if (ShellCommandGetExit()) {
return ((EFI_STATUS)ShellCommandGetExitCode());
}
return (Status);
}
/**
Sets all the alias' that were registered with the ShellCommandLib library.
@retval EFI_SUCCESS all init commands were run sucessfully.
**/
)
{
//
// Get all the commands we want to run
//
//
// for each command in the List
//
){
//
// install the alias'
//
}
return (EFI_SUCCESS);
}
/**
Internal function to determine if 2 command names are really the same.
@param[in] Command1 The pointer to the first command name.
@param[in] Command2 The pointer to the second command name.
@retval TRUE The 2 command names are the same.
@retval FALSE The 2 command names are not the same.
**/
)
{
return (TRUE);
}
return (FALSE);
}
/**
Internal function to determine if a command is a script only command.
@param[in] CommandName The pointer to the command name.
@retval TRUE The command is a script only command.
@retval FALSE The command is not a script only command.
**/
)
{
return (TRUE);
}
return (FALSE);
}
/**
This function will populate the 2 device path protocol parameters based on the
global gImageHandle. The DevPath will point to the device path for the handle that has
loaded image protocol installed on it. The FilePath will point to the device path
for the file that was loaded.
@param[in, out] DevPath On a sucessful return the device path to the loaded image.
@param[in, out] FilePath On a sucessful return the device path to the file.
@retval EFI_SUCCESS The 2 device paths were sucessfully returned.
@retval other A error from gBS->HandleProtocol.
@sa HandleProtocol
**/
)
{
(VOID**)&LoadedImage,
NULL,
);
(VOID**)&ImageDevicePath,
NULL,
);
NULL);
}
NULL);
}
return (Status);
}
{L"-nostartup", TypeFlag},
{L"-startup", TypeFlag},
{L"-noconsoleout", TypeFlag},
{L"-noconsolein", TypeFlag},
{L"-nointerrupt", TypeFlag},
{L"-nomap", TypeFlag},
{L"-noversion", TypeFlag},
{L"-startup", TypeFlag},
{L"-delay", TypeValue},
};
/**
Process all Uefi Shell 2.0 command line options.
see Uefi Shell 2.0 section 3.2 for full details.
the command line must resemble the following:
shell.efi [ShellOpt-options] [options] [file-name [file-name-options]]
ShellOpt-options Options which control the initialization behavior of the shell.
These options are read from the EFI global variable "ShellOpt"
and are processed before options or file-name.
options Options which control the initialization behavior of the shell.
file-name The name of a UEFI shell application or script to be executed
after initialization is complete. By default, if file-name is
specified, then -nostartup is implied. Scripts are not supported
by level 0.
file-name-options The command-line options that are passed to file-name when it
is invoked.
This will initialize the ShellInfoObject.ShellInitSettings global variable.
@retval EFI_SUCCESS The variable is initialized.
**/
)
{
ProblemParam = NULL;
Count = 1;
Size = 0;
return (EFI_OUT_OF_RESOURCES);
}
if (StrCmp(gEfiShellParametersProtocol->Argv[LoopVar], ShellInfoObject.ShellInitSettings.FileName)==0) {
LoopVar++;
//
// We found the file... add the rest of the params...
//
ASSERT((ShellInfoObject.ShellInitSettings.FileOptions == NULL && Size == 0) || (ShellInfoObject.ShellInitSettings.FileOptions != NULL));
&Size,
L" ",
0);
return (EFI_OUT_OF_RESOURCES);
}
&Size,
0);
return (EFI_OUT_OF_RESOURCES);
}
}
}
}
} else {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), ShellInfoObject.HiiHandle, ProblemParam);
return (EFI_INVALID_PARAMETER);
}
}
ShellInfoObject.ShellInitSettings.BitUnion.Bits.Startup = ShellCommandLineGetFlag(Package, L"-startup");
ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoStartup = ShellCommandLineGetFlag(Package, L"-nostartup");
ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleOut = ShellCommandLineGetFlag(Package, L"-noconsoleout");
ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleIn = ShellCommandLineGetFlag(Package, L"-noconsolein");
ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoInterrupt = ShellCommandLineGetFlag(Package, L"-nointerrupt");
ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoMap = ShellCommandLineGetFlag(Package, L"-nomap");
ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoVersion = ShellCommandLineGetFlag(Package, L"-noversion");
ShellInfoObject.ShellInitSettings.BitUnion.Bits.Delay = ShellCommandLineGetFlag(Package, L"-delay");
TempConst++;
}
if (TempConst != NULL && !EFI_ERROR(ShellConvertStringToUint64(TempConst, &Intermediate, FALSE, FALSE))) {
}
}
return (Status);
}
/**
Handles all interaction with the default startup script.
this will check that the correct command line parameters were passed, handle the delay, and then start running the script.
@param ImagePath the path to the image for shell. first place to look for the startup script
@param FilePath the path to the file for shell. second place to look for the startup script.
@retval EFI_SUCCESS the variable is initialized.
**/
)
{
FileHandle = NULL;
if (!ShellInfoObject.ShellInitSettings.BitUnion.Bits.Startup && ShellInfoObject.ShellInitSettings.FileName != NULL) {
//
// launch something else instead
//
}
if (FileStringPath == NULL) {
return (EFI_OUT_OF_RESOURCES);
}
}
return (Status);
}
//
// for shell level 0 we do no scripts
// Without the Startup bit overriding we allow for nostartup to prevent scripts
//
|| (ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoStartup && !ShellInfoObject.ShellInitSettings.BitUnion.Bits.Startup)
){
return (EFI_SUCCESS);
}
//
// print out our warning and see if they press a key
//
; Delay--
){
ShellPrintHiiEx(0, gST->ConOut->Mode->CursorRow, NULL, STRING_TOKEN (STR_SHELL_STARTUP_QUESTION), ShellInfoObject.HiiHandle, Delay/10);
}
}
//
// ESC was pressed
//
return (EFI_SUCCESS);
}
//
// Try the first location (must be file system)
//
NewSize = 0;
if (FileStringPath == NULL) {
} else {
}
FileStringPath = StrnCatGrow(&FileStringPath, &NewSize, ((FILEPATH_DEVICE_PATH*)FilePath)->PathName, 0);
Status = ShellInfoObject.NewEfiShellProtocol->OpenFileByName(FileStringPath, &FileHandle, EFI_FILE_MODE_READ);
}
}
//
// Try the location
//
}
//
// If we got a file, run it
//
} else {
if (FileStringPath == NULL) {
//
// we return success since we dont need to have a startup script
//
} else {
}
}
return (Status);
}
/**
Function to perform the shell prompt looping. It will do a single prompt,
dispatch the result, and then return. It is expected that the caller will
call this function in a loop many times.
@retval EFI_SUCCESS
@retval RETURN_ABORTED
**/
)
{
//
// Get screen setting to decide size of the command line buffer
//
return EFI_OUT_OF_RESOURCES;
}
//
// Prompt for input
//
} else {
}
//
// Read a line from the console
//
Status = ShellInfoObject.NewEfiShellProtocol->ReadFile(ShellInfoObject.NewShellParametersProtocol->StdIn, &BufferSize, CmdLine);
//
// Null terminate the string and parse it
//
}
//
// Done with this command
//
return Status;
}
/**
Add a buffer to the Buffer To Free List for safely returning buffers to other
places without risking letting them modify internal shell information.
@param Buffer Something to pass to FreePool when the shell is exiting.
**/
VOID*
)
{
return (NULL);
}
return (Buffer);
}
/**
Add a buffer to the Line History List
@param Buffer The line buffer to add.
**/
)
{
}
/**
Checks if a string is an alias for another command. If yes, then it replaces the alias name
with the correct command name.
@param[in, out] CommandString Upon entry the potential alias. Upon return the
command name if it was an alias. If it was not
an alias it will be unchanged. This function may
change the buffer to fit the command name.
@retval EFI_SUCCESS The name was changed.
@retval EFI_SUCCESS The name was not an alias.
@retval EFI_OUT_OF_RESOURCES A memory allocation failed.
**/
)
{
return (EFI_SUCCESS);
}
if (*CommandString == NULL) {
return (EFI_OUT_OF_RESOURCES);
}
return (EFI_SUCCESS);
}
/**
Function allocates a new command line and replaces all instances of environment
variable names that are correctly preset to their values.
If the return value is not NULL the memory must be caller freed.
@param[in] OriginalCommandLine The original command line
@retval NULL An error ocurred.
@return The new command line with no environment variables present.
**/
)
{
ItemSize = 0;
///@todo update this to handle the %0 - %9 for scripting only (borrow from line 1256 area) ? ? ?
//
// calculate the size required for the post-conversion string...
//
if (CurrentScriptFile != NULL) {
){
){
//
// we need a preceeding and if there is space no ^ preceeding (if no space ignore)
//
}
}
}
}
){
}
){
//
// we need a preceeding and following % and if there is space no ^ preceeding (if no space ignore)
//
}
}
}
//
// Quick out if none were found...
//
return (Temp);
}
//
// now do the replacements...
//
return (NULL);
}
){
ShellCopySearchAndReplace(NewCommandLine1, NewCommandLine2, NewSize, ItemTemp, EfiShellGetEnv(MasterEnvList), TRUE, FALSE);
}
if (CurrentScriptFile != NULL) {
){
ShellCopySearchAndReplace(NewCommandLine1, NewCommandLine2, NewSize, AliasListNode->Alias, AliasListNode->CommandString, TRUE, FALSE);
}
}
return (NewCommandLine1);
}
/**
Internal function to run a command line with pipe usage.
@param[in] CmdLine The pointer to the command line.
@param[in] StdIn The pointer to the Standard input.
@param[in] StdOut The pointer to the Standard output.
@retval EFI_SUCCESS The split command is executed successfully.
@retval other Some error occurs when executing the split command.
**/
)
{
Size1 = 0;
Size2 = 0;
return (EFI_OUT_OF_RESOURCES);
}
if (NextCommandLine[0] != CHAR_NULL &&
NextCommandLine[0] == L'a' &&
){
} else {
}
//
// make a SPLIT_LIST item and add to list
//
//
// move the output from the first to the in to the second.
//
} else {
}
ShellInfoObject.NewEfiShellProtocol->SetFilePosition(ConvertShellHandleToEfiFileProtocol(Split->SplitStdIn), 0);
}
//
// remove the top level from the ScriptList
//
//
// Note that the original StdIn is now the StdOut...
//
ShellInfoObject.NewEfiShellProtocol->CloseFile(ConvertShellHandleToEfiFileProtocol(Split->SplitStdOut));
}
ShellInfoObject.NewEfiShellProtocol->CloseFile(ConvertShellHandleToEfiFileProtocol(Split->SplitStdIn));
}
return (Status);
}
/**
Function will process and run a command line.
This will determine if the command line represents an internal shell
command or dispatch an external application.
@param[in] CmdLine The command line to parse.
@retval EFI_SUCCESS The command was completed.
@retval EFI_ABORTED The command's operation was aborted.
**/
)
{
return (EFI_SUCCESS);
}
CommandName = NULL;
if (CleanOriginal == NULL) {
return (EFI_OUT_OF_RESOURCES);
}
}
while (CleanOriginal[0] == L' ') {
}
CommandName = NULL;
} else {
}
if (!ShellCommandIsCommandOnList(CommandName)) {
//
// Convert via alias
//
PostAliasSize = 0;
} else {
}
if (CleanOriginal != NULL) {
}
if (CommandName != NULL) {
CommandName = NULL;
}
//
// we can now free the modified by alias command line
//
if (PostAliasCmdLine != NULL) {
}
if (PostVariableCmdLine == NULL) {
return (EFI_OUT_OF_RESOURCES);
}
}
while (PostVariableCmdLine[0] == L' ') {
CopyMem(PostVariableCmdLine, PostVariableCmdLine+1, StrSize(PostVariableCmdLine) - sizeof(PostVariableCmdLine[0]));
}
//
// We dont do normal processing with a split command line (output from one command input to another)
//
for (TempLocation3 = PostVariableCmdLine ; TempLocation3 != NULL && *TempLocation3 != CHAR_NULL ; TempLocation3++) {
} else if (*TempLocation3 == L'|') {
break;
}
}
}
//
// are we in an existing split???
//
}
} else {
}
} else {
//
// If this is a mapped drive change handle that...
//
if (PostVariableCmdLine[(StrLen(PostVariableCmdLine)-1)] == L':' && StrStr(PostVariableCmdLine, L" ") == NULL) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_INVALID_MAPPING), ShellInfoObject.HiiHandle, PostVariableCmdLine);
}
return (Status);
}
///@todo update this section to divide into 3 ways - run internal command, run split (above), and run an external file...
/// We waste a lot of time doing processing like StdIn,StdOut,Argv,Argc for things that are external files...
Status = UpdateStdInStdOutStdErr(ShellInfoObject.NewShellParametersProtocol, PostVariableCmdLine, &OriginalStdIn, &OriginalStdOut, &OriginalStdErr, &OriginalSystemTableInfo);
if (Status == EFI_NOT_FOUND) {
} else {
}
} else {
}
while (PostVariableCmdLine[0] == L' ') {
CopyMem(PostVariableCmdLine, PostVariableCmdLine+1, StrSize(PostVariableCmdLine) - sizeof(PostVariableCmdLine[0]));
}
//
// get the argc and argv updated for internal commands
//
Status = UpdateArgcArgv(ShellInfoObject.NewShellParametersProtocol, PostVariableCmdLine, &Argv, &Argc);
if (StrStr(ShellInfoObject.NewShellParametersProtocol->Argv[Count], L"-?") == ShellInfoObject.NewShellParametersProtocol->Argv[Count]
|| (ShellInfoObject.NewShellParametersProtocol->Argv[0][0] == L'?' && ShellInfoObject.NewShellParametersProtocol->Argv[0][1] == CHAR_NULL)
) {
//
// We need to redo the arguments since a parameter was -?
// move them all down 1 to the end, then up one then replace the first with help
//
ShellInfoObject.NewShellParametersProtocol->Argv[Count2] = ShellInfoObject.NewShellParametersProtocol->Argv[Count2+1];
}
ShellInfoObject.NewShellParametersProtocol->Argv[Count2] = ShellInfoObject.NewShellParametersProtocol->Argv[Count2-1];
}
ShellInfoObject.NewShellParametersProtocol->Argv[0] = StrnCatGrow(&ShellInfoObject.NewShellParametersProtocol->Argv[0], NULL, L"help", 0);
break;
}
}
//
// command or file?
//
//
// Run the command (which was converted if it was an alias)
//
Status = ShellCommandRunCommandHandler(ShellInfoObject.NewShellParametersProtocol->Argv[0], &ShellStatus, &LastError);
if (LastError) {
}
//
// Pass thru the exitcode from the app.
//
if (ShellCommandGetExit()) {
} else if (ShellStatus != 0 && IsScriptOnlyCommand(ShellInfoObject.NewShellParametersProtocol->Argv[0])) {
}
}
} else {
//
// run an external file (or script)
//
CommandWithPath = StrnCatGrow(&CommandWithPath, NULL, ShellInfoObject.NewShellParametersProtocol->Argv[0], 0);
}
}
if (CommandWithPath == NULL) {
CommandWithPath = ShellFindFilePathEx(ShellInfoObject.NewShellParametersProtocol->Argv[0], mExecutableExtensions);
}
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_NOT_FOUND), ShellInfoObject.HiiHandle, ShellInfoObject.NewShellParametersProtocol->Argv[0]);
} else {
//
// Check if it's a NSH (script) file.
//
if ((StrLen(CommandWithPath) > 4) && (StringNoCaseCompare((VOID*)(&TempLocation), (VOID*)(&TempLocation2)) == 0)) {
} else {
NULL,
);
}
}
}
CommandName = StrnCatGrow(&CommandName, NULL, ShellInfoObject.NewShellParametersProtocol->Argv[0], 0);
RestoreStdInStdOutStdErr(ShellInfoObject.NewShellParametersProtocol, &OriginalStdIn, &OriginalStdOut, &OriginalStdErr, &OriginalSystemTableInfo);
}
if (CommandName != NULL) {
//
// if this is NOT a scipt only command return success so the script won't quit.
// prevent killing the script - this is the only place where we know the actual command name (after alias and variable replacement...)
//
}
}
}
return (Status);
}
/**
Function determins if the CommandName COULD be a valid command. It does not determine whether
this is a valid command. It only checks for invalid characters.
@param[in] CommandName The name to check
@retval TRUE CommandName could be a command name
@retval FALSE CommandName could not be a valid command name
**/
)
{
if (CommandName == NULL) {
return (FALSE);
}
for ( Count = 0
; Count++
){
return (FALSE);
}
}
return (TRUE);
}
/**
Function to process a NSH script file via SHELL_FILE_HANDLE.
@param[in] Handle The handle to the already opened file.
@param[in] Name The name of the script file.
@retval EFI_SUCCESS the script completed sucessfully
**/
)
{
if (NewScriptFile == NULL) {
return (EFI_OUT_OF_RESOURCES);
}
//
// Set up the name
//
return (EFI_OUT_OF_RESOURCES);
}
//
// Save the parameters (used to replace %0 to %9 later on)
//
if (NewScriptFile->Argc != 0) {
return (EFI_OUT_OF_RESOURCES);
}
NewScriptFile->Argv[LoopVar] = StrnCatGrow(&NewScriptFile->Argv[LoopVar], NULL, ShellInfoObject.NewShellParametersProtocol->Argv[LoopVar], 0);
return (EFI_OUT_OF_RESOURCES);
}
}
} else {
}
//
// Now build the list of all script commands.
//
LineCount = 0;
while(!ShellFileHandleEof(Handle)) {
LineCount++;
continue;
}
return (EFI_OUT_OF_RESOURCES);
}
}
//
// Add this as the topmost script file
//
//
// Now enumerate through the commands and run each one.
//
if (CommandLine == NULL) {
return (EFI_OUT_OF_RESOURCES);
}
if (CommandLine2 == NULL) {
return (EFI_OUT_OF_RESOURCES);
}
for ( NewScriptFile->CurrentCommand = (SCRIPT_COMMAND_LIST *)GetFirstNode(&NewScriptFile->CommandList)
; // conditional increment in the body of the loop
){
//
// NULL out comments
//
for (CommandLine3 = CommandLine2 ; CommandLine3 != NULL && *CommandLine3 != CHAR_NULL ; CommandLine3++) {
if (*CommandLine3 == L'^') {
}
} else if (*CommandLine3 == L'#') {
}
}
//
// Due to variability in starting the find and replace action we need to have both buffers the same.
//
//
// Remove the %0 to %9 from the command line (if we have some arguments)
//
switch (NewScriptFile->Argc) {
default:
Status = ShellCopySearchAndReplace(CommandLine2, CommandLine, PcdGet16 (PcdShellPrintBufferSize), L"%9", NewScriptFile->Argv[9], FALSE, TRUE);
case 9:
Status = ShellCopySearchAndReplace(CommandLine, CommandLine2, PcdGet16 (PcdShellPrintBufferSize), L"%8", NewScriptFile->Argv[8], FALSE, TRUE);
case 8:
Status = ShellCopySearchAndReplace(CommandLine2, CommandLine, PcdGet16 (PcdShellPrintBufferSize), L"%7", NewScriptFile->Argv[7], FALSE, TRUE);
case 7:
Status = ShellCopySearchAndReplace(CommandLine, CommandLine2, PcdGet16 (PcdShellPrintBufferSize), L"%6", NewScriptFile->Argv[6], FALSE, TRUE);
case 6:
Status = ShellCopySearchAndReplace(CommandLine2, CommandLine, PcdGet16 (PcdShellPrintBufferSize), L"%5", NewScriptFile->Argv[5], FALSE, TRUE);
case 5:
Status = ShellCopySearchAndReplace(CommandLine, CommandLine2, PcdGet16 (PcdShellPrintBufferSize), L"%4", NewScriptFile->Argv[4], FALSE, TRUE);
case 4:
Status = ShellCopySearchAndReplace(CommandLine2, CommandLine, PcdGet16 (PcdShellPrintBufferSize), L"%3", NewScriptFile->Argv[3], FALSE, TRUE);
case 3:
Status = ShellCopySearchAndReplace(CommandLine, CommandLine2, PcdGet16 (PcdShellPrintBufferSize), L"%2", NewScriptFile->Argv[2], FALSE, TRUE);
case 2:
Status = ShellCopySearchAndReplace(CommandLine2, CommandLine, PcdGet16 (PcdShellPrintBufferSize), L"%1", NewScriptFile->Argv[1], FALSE, TRUE);
case 1:
Status = ShellCopySearchAndReplace(CommandLine, CommandLine2, PcdGet16 (PcdShellPrintBufferSize), L"%0", NewScriptFile->Argv[0], FALSE, TRUE);
break;
case 0:
break;
}
}
Status = ShellCopySearchAndReplace(CommandLine2, CommandLine, PcdGet16 (PcdShellPrintBufferSize), L"%1", L"\"\"", FALSE, FALSE);
Status = ShellCopySearchAndReplace(CommandLine, CommandLine2, PcdGet16 (PcdShellPrintBufferSize), L"%2", L"\"\"", FALSE, FALSE);
Status = ShellCopySearchAndReplace(CommandLine2, CommandLine, PcdGet16 (PcdShellPrintBufferSize), L"%3", L"\"\"", FALSE, FALSE);
Status = ShellCopySearchAndReplace(CommandLine, CommandLine2, PcdGet16 (PcdShellPrintBufferSize), L"%4", L"\"\"", FALSE, FALSE);
Status = ShellCopySearchAndReplace(CommandLine2, CommandLine, PcdGet16 (PcdShellPrintBufferSize), L"%5", L"\"\"", FALSE, FALSE);
Status = ShellCopySearchAndReplace(CommandLine, CommandLine2, PcdGet16 (PcdShellPrintBufferSize), L"%6", L"\"\"", FALSE, FALSE);
Status = ShellCopySearchAndReplace(CommandLine2, CommandLine, PcdGet16 (PcdShellPrintBufferSize), L"%7", L"\"\"", FALSE, FALSE);
Status = ShellCopySearchAndReplace(CommandLine, CommandLine2, PcdGet16 (PcdShellPrintBufferSize), L"%8", L"\"\"", FALSE, FALSE);
Status = ShellCopySearchAndReplace(CommandLine2, CommandLine, PcdGet16 (PcdShellPrintBufferSize), L"%9", L"\"\"", FALSE, FALSE);
//
// This line is a goto target / label
//
} else {
if (CommandLine3[0] == L'@') {
//
// We need to save the current echo state
// and disable echo for just this command.
//
//
// Now restore the pre-'@' echo state.
//
} else {
if (ShellCommandGetEchoState()) {
} else {
}
}
}
}
if (ShellCommandGetScriptExit()) {
break;
}
break;
}
if (ShellCommandGetExit()) {
break;
}
}
//
// If that commend did not update the CurrentCommand then we need to advance it...
//
NewScriptFile->CurrentCommand = (SCRIPT_COMMAND_LIST *)GetNextNode(&NewScriptFile->CommandList, &NewScriptFile->CurrentCommand->Link);
}
}
} else {
NewScriptFile->CurrentCommand = (SCRIPT_COMMAND_LIST *)GetNextNode(&NewScriptFile->CommandList, &NewScriptFile->CurrentCommand->Link);
}
}
}
//
// Only if this was the last script reset the state.
//
if (ShellCommandGetCurrentScriptFile()==NULL) {
}
return (EFI_SUCCESS);
}
/**
Function to process a NSH script file.
@param[in] ScriptPath Pointer to the script file name (including file system path).
@retval EFI_SUCCESS the script completed sucessfully
**/
)
{
return (EFI_INVALID_PARAMETER);
}
return (Status);
}
return (Status);
}