TianoCore EDK2 master
|
#include "Shell.h"
Go to the source code of this file.
Data Structures | |
struct | SYSTEM_TABLE_INFO |
Enumerations | |
enum | SHELL_OPERATION_TYPES { Internal_Command , Script_File_Name , Efi_Application , File_Sys_Change , Unknown_Invalid } |
Functions | |
EFI_STATUS | CreatePopulateInstallShellParametersProtocol (IN OUT EFI_SHELL_PARAMETERS_PROTOCOL **NewShellParameters, IN OUT BOOLEAN *RootShellInstance) |
EFI_STATUS | CleanUpShellParametersProtocol (IN OUT EFI_SHELL_PARAMETERS_PROTOCOL *NewShellParameters) |
EFI_STATUS | UpdateArgcArgv (IN OUT EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters, IN CONST CHAR16 *NewCommandLine, IN SHELL_OPERATION_TYPES Type, OUT CHAR16 ***OldArgv, OUT UINTN *OldArgc) |
VOID | RestoreArgcArgv (IN OUT EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters, IN CHAR16 ***OldArgv, IN UINTN *OldArgc) |
EFI_STATUS | UpdateStdInStdOutStdErr (IN OUT EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters, IN CHAR16 *NewCommandLine, OUT SHELL_FILE_HANDLE *OldStdIn, OUT SHELL_FILE_HANDLE *OldStdOut, OUT SHELL_FILE_HANDLE *OldStdErr, OUT SYSTEM_TABLE_INFO *SystemTableInfo) |
EFI_STATUS | RestoreStdInStdOutStdErr (IN OUT EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters, IN SHELL_FILE_HANDLE *OldStdIn, IN SHELL_FILE_HANDLE *OldStdOut, IN SHELL_FILE_HANDLE *OldStdErr, IN SYSTEM_TABLE_INFO *SystemTableInfo) |
EFI_STATUS | ParseCommandLineToArgs (IN CONST CHAR16 *CommandLine, IN BOOLEAN StripQuotation, IN OUT CHAR16 ***Argv, IN OUT UINTN *Argc) |
EFI_STATUS | GetNextParameter (IN OUT CHAR16 **Walker, IN OUT CHAR16 **TempParameter, IN CONST UINTN Length, IN BOOLEAN StripQuotation) |
Member functions of EFI_SHELL_PARAMETERS_PROTOCOL and functions for creation, manipulation, and initialization of EFI_SHELL_PARAMETERS_PROTOCOL.
Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file ShellParametersProtocol.h.
enum SHELL_OPERATION_TYPES |
Definition at line 15 of file ShellParametersProtocol.h.
EFI_STATUS CleanUpShellParametersProtocol | ( | IN OUT EFI_SHELL_PARAMETERS_PROTOCOL * | NewShellParameters | ) |
frees all memory used by creation and installation of shell parameters protocol and if there was an old version installed it will restore that one.
NewShellParameters | the interface of EFI_SHELL_PARAMETERS_PROTOCOL that is being cleaned up. |
EFI_SUCCESS | the cleanup was successful |
Definition at line 447 of file ShellParametersProtocol.c.
EFI_STATUS CreatePopulateInstallShellParametersProtocol | ( | IN OUT EFI_SHELL_PARAMETERS_PROTOCOL ** | NewShellParameters, |
IN OUT BOOLEAN * | RootShellInstance | ||
) |
creates a new EFI_SHELL_PARAMETERS_PROTOCOL instance and populates it and then installs it on our handle and if there is an existing version of the protocol that one is cached for removal later.
[in,out] | NewShellParameters | on a successful return, a pointer to pointer to the newly installed interface. |
[in,out] | RootShellInstance | on a successful return, pointer to boolean. TRUE if this is the root shell instance. |
EFI_SUCCESS | the operation completed successfully. |
Definition at line 293 of file ShellParametersProtocol.c.
EFI_STATUS GetNextParameter | ( | IN OUT CHAR16 ** | Walker, |
IN OUT CHAR16 ** | TempParameter, | ||
IN CONST UINTN | Length, | ||
IN BOOLEAN | StripQuotation | ||
) |
return the next parameter from a command line string;
This function moves the next parameter from Walker into TempParameter and moves Walker up past that parameter for recursive calling. When the final parameter is moved *Walker will be set to NULL;
Temp Parameter must be large enough to hold the parameter before calling this function.
[in,out] | Walker | pointer to string of command line. Adjusted to remaining command line on return |
[in,out] | TempParameter | pointer to string of command line item extracted. |
[in] | Length | Length of (*TempParameter) in bytes |
[in] | StripQuotation | if TRUE then strip the quotation marks surrounding the parameters. |
Definition at line 82 of file ShellParametersProtocol.c.
EFI_STATUS ParseCommandLineToArgs | ( | IN CONST CHAR16 * | CommandLine, |
IN BOOLEAN | StripQuotation, | ||
IN OUT CHAR16 *** | Argv, | ||
IN OUT UINTN * | Argc | ||
) |
function to populate Argc and Argv.
This function parses the CommandLine and divides it into standard C style Argc/Argv parameters for inclusion in EFI_SHELL_PARAMETERS_PROTOCOL. this supports space delimited and quote surrounded parameter definition.
[in] | CommandLine | String of command line to parse |
[in] | StripQuotation | if TRUE then strip the quotation marks surrounding the parameters. |
[in,out] | Argv | pointer to array of strings; one for each parameter |
[in,out] | Argc | pointer to number of strings in Argv array |
Function to populate Argc and Argv.
This function parses the CommandLine and divides it into standard C style Argc/Argv parameters for inclusion in EFI_SHELL_PARAMETERS_PROTOCOL. this supports space delimited and quote surrounded parameter definition.
All special character processing (alias, environment variable, redirection, etc... must be complete before calling this API.
[in] | CommandLine | String of command line to parse |
[in] | StripQuotation | if TRUE then strip the quotation marks surrounding the parameters. |
[in,out] | Argv | pointer to array of strings; one for each parameter |
[in,out] | Argc | pointer to number of strings in Argv array |
Definition at line 191 of file ShellParametersProtocol.c.
VOID RestoreArgcArgv | ( | IN OUT EFI_SHELL_PARAMETERS_PROTOCOL * | ShellParameters, |
IN CHAR16 *** | OldArgv, | ||
IN UINTN * | OldArgc | ||
) |
Function will replace the current Argc and Argv in the ShellParameters protocol structure with Argv and Argc. The current values are de-allocated and the OldArgv must not be deallocated by the caller.
[in,out] | ShellParameters | pointer to parameter structure to modify |
[in] | OldArgv | pointer to old list of parameters |
[in] | OldArgc | pointer to old number of items in Argv list |
Definition at line 1499 of file ShellParametersProtocol.c.
EFI_STATUS RestoreStdInStdOutStdErr | ( | IN OUT EFI_SHELL_PARAMETERS_PROTOCOL * | ShellParameters, |
IN SHELL_FILE_HANDLE * | OldStdIn, | ||
IN SHELL_FILE_HANDLE * | OldStdOut, | ||
IN SHELL_FILE_HANDLE * | OldStdErr, | ||
IN SYSTEM_TABLE_INFO * | SystemTableInfo | ||
) |
Function will replace the current StdIn and StdOut in the ShellParameters protocol structure with StdIn and StdOut. The current values are de-allocated.
[in,out] | ShellParameters | Pointer to parameter structure to modify. |
[in] | OldStdIn | Pointer to old StdIn. |
[in] | OldStdOut | Pointer to old StdOut. |
[in] | OldStdErr | Pointer to old StdErr. |
[in] | SystemTableInfo | Pointer to old system table information. |
Definition at line 1368 of file ShellParametersProtocol.c.
EFI_STATUS UpdateArgcArgv | ( | IN OUT EFI_SHELL_PARAMETERS_PROTOCOL * | ShellParameters, |
IN CONST CHAR16 * | NewCommandLine, | ||
IN SHELL_OPERATION_TYPES | Type, | ||
OUT CHAR16 *** | OldArgv, | ||
OUT UINTN * | OldArgc | ||
) |
Function will replace the current Argc and Argv in the ShellParameters protocol structure by parsing NewCommandLine. The current values are returned to the user.
[in,out] | ShellParameters | pointer to parameter structure to modify |
[in] | NewCommandLine | the new command line to parse and use |
[in] | Type | the type of operation. |
[out] | OldArgv | pointer to old list of parameters |
[out] | OldArgc | pointer to old number of items in Argv list |
EFI_SUCCESS | operation was successful, Argv and Argc are valid |
EFI_OUT_OF_RESOURCES | a memory allocation failed. |
EFI_STATUS UpdateStdInStdOutStdErr | ( | IN OUT EFI_SHELL_PARAMETERS_PROTOCOL * | ShellParameters, |
IN CHAR16 * | NewCommandLine, | ||
OUT SHELL_FILE_HANDLE * | OldStdIn, | ||
OUT SHELL_FILE_HANDLE * | OldStdOut, | ||
OUT SHELL_FILE_HANDLE * | OldStdErr, | ||
OUT SYSTEM_TABLE_INFO * | SystemTableInfo | ||
) |
Function will replace the current StdIn and StdOut in the ShellParameters protocol structure by parsing NewCommandLine. The current values are returned to the user.
This will also update the system table.
[in,out] | ShellParameters | Pointer to parameter structure to modify. |
[in] | NewCommandLine | The new command line to parse and use. |
[out] | OldStdIn | Pointer to old StdIn. |
[out] | OldStdOut | Pointer to old StdOut. |
[out] | OldStdErr | Pointer to old StdErr. |
[out] | SystemTableInfo | Pointer to old system table information. |
EFI_SUCCESS | Operation was successful, Argv and Argc are valid. |
EFI_OUT_OF_RESOURCES | A memory allocation failed. |
Definition at line 701 of file ShellParametersProtocol.c.