TianoCore EDK2 master
|
#include "Shell.h"
Go to the source code of this file.
Functions | |
CONST CHAR16 * | FindEndOfParameter (IN CONST CHAR16 *String) |
EFI_STATUS | GetNextParameter (IN OUT CHAR16 **Walker, IN OUT CHAR16 **TempParameter, IN CONST UINTN Length, IN BOOLEAN StripQuotation) |
EFI_STATUS | ParseCommandLineToArgs (IN CONST CHAR16 *CommandLine, IN BOOLEAN StripQuotation, IN OUT CHAR16 ***Argv, IN OUT UINTN *Argc) |
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 | IsUnicodeFile (IN CONST CHAR16 *FileName) |
VOID | StripQuotes (IN OUT CHAR16 *TheString) |
VOID | CalculateEfiHdrCrc (IN OUT EFI_TABLE_HEADER *Hdr) |
CHAR16 * | FixFileName (IN CHAR16 *FileName) |
CHAR16 * | FixVarName (IN CHAR16 *FileName) |
EFI_STATUS | WriteFileTag (IN SHELL_FILE_HANDLE FileHandle) |
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 | UpdateArgcArgv (IN OUT EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters, IN CONST CHAR16 *NewCommandLine, IN SHELL_OPERATION_TYPES Type, OUT CHAR16 ***OldArgv OPTIONAL, OUT UINTN *OldArgc OPTIONAL) |
VOID | RestoreArgcArgv (IN OUT EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters, IN CHAR16 ***OldArgv, IN UINTN *OldArgc) |
Variables | |
BOOLEAN | AsciiRedirection = FALSE |
Member functions of EFI_SHELL_PARAMETERS_PROTOCOL and functions for creation, manipulation, and initialization of EFI_SHELL_PARAMETERS_PROTOCOL.
(C) Copyright 2016 Hewlett Packard Enterprise Development LP
Copyright (C) 2014, Red Hat, Inc. (C) Copyright 2013 Hewlett-Packard Development Company, L.P.
Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file ShellParametersProtocol.c.
VOID CalculateEfiHdrCrc | ( | IN OUT EFI_TABLE_HEADER * | Hdr | ) |
Calculate the 32-bit CRC in a EFI table using the service provided by the gRuntime service.
Hdr | Pointer to an EFI standard header |
Definition at line 564 of file ShellParametersProtocol.c.
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.
Return the next parameter's end from a command line string.
[in] | String | the string to parse |
Definition at line 23 of file ShellParametersProtocol.c.
CHAR16 * FixFileName | ( | IN CHAR16 * | FileName | ) |
Fix a string to only have the file name, removing starting at the first space of whatever is quoted.
[in] | FileName | The filename to start with. |
NULL | FileName was invalid. |
Definition at line 590 of file ShellParametersProtocol.c.
CHAR16 * FixVarName | ( | IN CHAR16 * | FileName | ) |
Fix a string to only have the environment variable name, removing starting at the first space of whatever is quoted and removing the leading and trailing %.
[in] | FileName | The filename to start with. |
NULL | FileName was invalid. |
Definition at line 633 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.
This will also remove all remaining ^ characters after processing.
[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 | buffer size of TempParameter. |
[in] | StripQuotation | if TRUE then strip the quotation marks surrounding the parameters. |
Definition at line 82 of file ShellParametersProtocol.c.
EFI_STATUS IsUnicodeFile | ( | IN CONST CHAR16 * | FileName | ) |
Determine if a file name represents a unicode file.
[in] | FileName | Pointer to the filename to open. |
EFI_SUCCESS | The file is a unicode file. |
Definition at line 503 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.
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.
Strips out quotes sections of a string.
All of the characters between quotes is replaced with spaces.
[in,out] | TheString | A pointer to the string to update. |
Definition at line 539 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 | OPTIONAL, | ||
OUT UINTN *OldArgc | OPTIONAL | ||
) |
Function will replace the current Argc and Argv in the ShellParameters protocol structure by parsing NewCommandLine. The current values are returned to the user.
If OldArgv or OldArgc is NULL then that value is not returned.
[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. |
Definition at line 1456 of file ShellParametersProtocol.c.
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.
EFI_STATUS WriteFileTag | ( | IN SHELL_FILE_HANDLE | FileHandle | ) |
Write the unicode file tag to the specified file.
It is the caller's responsibility to ensure that ShellInfoObject.NewEfiShellProtocol has been initialized before calling this function.
[in] | FileHandle | The file to write the unicode file tag to. |
Definition at line 664 of file ShellParametersProtocol.c.
BOOLEAN AsciiRedirection = FALSE |
Definition at line 15 of file ShellParametersProtocol.c.