mirror of
https://github.com/tianocore/edk2
synced 2026-08-27 00:23:19 -04:00
ShellPkg/UefiShellLevel2: Extract MainCmdXXX() function
This patch aims to help breaking down the long function present in the ShellPkg and reduce complexity/nested code and conditions. Extract a MainCmdXXX() function for each shell command. This command contains the possible operations the command aims to operate. The ShellCommandRunXXX() function from which it is extracted is only responsible of: - initializing the shell/command environment - parsing the command parameter and creating a Package - freeing the Package No functional change should be induced by this patch. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
This commit is contained in:
parent
ce88903374
commit
531b0aa002
14 changed files with 951 additions and 627 deletions
|
|
@ -23,24 +23,19 @@ STATIC CONST SHELL_PARAM_ITEM AttribParamList[] = {
|
|||
{ NULL, TypeMax }
|
||||
};
|
||||
|
||||
/**
|
||||
Function for 'attrib' command.
|
||||
/** Main function of the 'Attrib' command.
|
||||
|
||||
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||
@param[in] Package List of input parameter for the command.
|
||||
**/
|
||||
STATIC
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunAttrib (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
MainCmdAttrib (
|
||||
LIST_ENTRY *Package
|
||||
)
|
||||
{
|
||||
UINT64 FileAttributesToAdd;
|
||||
UINT64 FileAttributesToRemove;
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
UINTN ParamNumberCount;
|
||||
CONST CHAR16 *FileName;
|
||||
|
|
@ -48,31 +43,8 @@ ShellCommandRunAttrib (
|
|||
EFI_SHELL_FILE_INFO *FileNode;
|
||||
EFI_FILE_INFO *FileInfo;
|
||||
|
||||
ListOfFiles = NULL;
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
ProblemParam = NULL;
|
||||
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// parse the command line
|
||||
//
|
||||
Status = ShellCommandLineParse (AttribParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"attrib", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
ListOfFiles = NULL;
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
|
||||
//
|
||||
// check for "-?"
|
||||
|
|
@ -272,6 +244,54 @@ ShellCommandRunAttrib (
|
|||
}
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
Function for 'attrib' command.
|
||||
|
||||
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||
**/
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunAttrib (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
ProblemParam = NULL;
|
||||
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// parse the command line
|
||||
//
|
||||
Status = ShellCommandLineParse (AttribParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"attrib", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
ShellStatus = MainCmdAttrib (Package);
|
||||
|
||||
//
|
||||
// free the command line package
|
||||
//
|
||||
|
|
|
|||
|
|
@ -162,25 +162,20 @@ ExtractDriveAndPath (
|
|||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
Function for 'cd' command.
|
||||
/** Main function of the 'Cd' command.
|
||||
|
||||
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||
@param[in] Package List of input parameter for the command.
|
||||
**/
|
||||
STATIC
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunCd (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
MainCmdCd (
|
||||
LIST_ENTRY *Package
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CONST CHAR16 *Cwd;
|
||||
CHAR16 *Path;
|
||||
CHAR16 *Drive;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
CONST CHAR16 *Param1;
|
||||
CHAR16 *Param1Copy;
|
||||
|
|
@ -189,39 +184,13 @@ ShellCommandRunCd (
|
|||
CHAR16 *TempBuffer;
|
||||
UINTN TotalSize;
|
||||
|
||||
ProblemParam = NULL;
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
Cwd = NULL;
|
||||
Path = NULL;
|
||||
Drive = NULL;
|
||||
Splitter = NULL;
|
||||
TempBuffer = NULL;
|
||||
TotalSize = 0;
|
||||
|
||||
Status = CommandInit ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// parse the command line
|
||||
//
|
||||
Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"cd", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
Cwd = NULL;
|
||||
Path = NULL;
|
||||
Drive = NULL;
|
||||
Splitter = NULL;
|
||||
TempBuffer = NULL;
|
||||
TotalSize = 0;
|
||||
|
||||
//
|
||||
// check for "-?"
|
||||
|
|
@ -340,6 +309,57 @@ ShellCommandRunCd (
|
|||
}
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
Function for 'cd' command.
|
||||
|
||||
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||
**/
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunCd (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
|
||||
ProblemParam = NULL;
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
|
||||
Status = CommandInit ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// parse the command line
|
||||
//
|
||||
Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"cd", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
ShellStatus = MainCmdCd (Package);
|
||||
|
||||
//
|
||||
// free the command line package
|
||||
//
|
||||
|
|
|
|||
|
|
@ -649,22 +649,17 @@ STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
|
|||
{ NULL, TypeMax }
|
||||
};
|
||||
|
||||
/**
|
||||
Function for 'cp' command.
|
||||
/** Main function of the 'Cp' command.
|
||||
|
||||
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||
@param[in] Package List of input parameter for the command.
|
||||
**/
|
||||
STATIC
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunCp (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
MainCmdCp (
|
||||
LIST_ENTRY *Package
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
UINTN ParamCount;
|
||||
UINTN LoopCounter;
|
||||
|
|
@ -674,35 +669,9 @@ ShellCommandRunCp (
|
|||
CONST CHAR16 *Cwd;
|
||||
CHAR16 *FullCwd;
|
||||
|
||||
ProblemParam = NULL;
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
ParamCount = 0;
|
||||
FileList = NULL;
|
||||
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = CommandInit ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// parse the command line
|
||||
//
|
||||
Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"cp", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
ParamCount = 0;
|
||||
FileList = NULL;
|
||||
|
||||
//
|
||||
// check for "-?"
|
||||
|
|
@ -797,6 +766,57 @@ ShellCommandRunCp (
|
|||
ShellCloseFileMetaArg (&FileList);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
Function for 'cp' command.
|
||||
|
||||
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||
**/
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunCp (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
|
||||
ProblemParam = NULL;
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = CommandInit ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// parse the command line
|
||||
//
|
||||
Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"cp", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
ShellStatus = MainCmdCp (Package);
|
||||
|
||||
//
|
||||
// free the command line package
|
||||
//
|
||||
|
|
|
|||
|
|
@ -179,52 +179,24 @@ STATIC CONST SHELL_PARAM_ITEM LoadParamList[] = {
|
|||
{ NULL, TypeMax }
|
||||
};
|
||||
|
||||
/**
|
||||
Function for 'load' command.
|
||||
/** Main function of the 'Load' command.
|
||||
|
||||
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||
@param[in] Package List of input parameter for the command.
|
||||
**/
|
||||
STATIC
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunLoad (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
MainCmdLoad (
|
||||
LIST_ENTRY *Package
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
UINTN ParamCount;
|
||||
EFI_SHELL_FILE_INFO *ListHead;
|
||||
EFI_SHELL_FILE_INFO *Node;
|
||||
|
||||
ListHead = NULL;
|
||||
ProblemParam = NULL;
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// parse the command line
|
||||
//
|
||||
Status = ShellCommandLineParse (LoadParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"load", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
ListHead = NULL;
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
|
||||
//
|
||||
// check for "-?"
|
||||
|
|
@ -275,6 +247,54 @@ ShellCommandRunLoad (
|
|||
} // for loop for params
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
Function for 'load' command.
|
||||
|
||||
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||
**/
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunLoad (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
|
||||
ProblemParam = NULL;
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// parse the command line
|
||||
//
|
||||
Status = ShellCommandLineParse (LoadParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"load", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
ShellStatus = MainCmdLoad (Package);
|
||||
|
||||
//
|
||||
// free the command line package
|
||||
//
|
||||
|
|
|
|||
|
|
@ -693,22 +693,18 @@ STATIC CONST SHELL_PARAM_ITEM LsParamList[] = {
|
|||
{ NULL, TypeMax }
|
||||
};
|
||||
|
||||
/**
|
||||
Function for 'ls' command.
|
||||
/** Main function of the 'Ls' command.
|
||||
|
||||
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||
@param[in] Package List of input parameter for the command.
|
||||
**/
|
||||
STATIC
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunLs (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
MainCmdLs (
|
||||
LIST_ENTRY *Package
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
EFI_STATUS Status;
|
||||
|
||||
CONST CHAR16 *Attribs;
|
||||
SHELL_STATUS ShellStatus;
|
||||
UINT64 RequiredAttributes;
|
||||
|
|
@ -723,7 +719,6 @@ ShellCommandRunLs (
|
|||
|
||||
Size = 0;
|
||||
FullPath = NULL;
|
||||
ProblemParam = NULL;
|
||||
Attribs = NULL;
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
RequiredAttributes = 0;
|
||||
|
|
@ -733,34 +728,6 @@ ShellCommandRunLs (
|
|||
Count = 0;
|
||||
ListUnfiltered = FALSE;
|
||||
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// Fix local copies of the protocol pointers
|
||||
//
|
||||
Status = CommandInit ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// parse the command line
|
||||
//
|
||||
Status = ShellCommandLineParse (LsParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"ls", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
//
|
||||
// check for "-?"
|
||||
//
|
||||
|
|
@ -934,6 +901,64 @@ ShellCommandRunLs (
|
|||
//
|
||||
SHELL_FREE_NON_NULL (SearchString);
|
||||
SHELL_FREE_NON_NULL (FullPath);
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
Function for 'ls' command.
|
||||
|
||||
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||
**/
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunLs (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
|
||||
ProblemParam = NULL;
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// Fix local copies of the protocol pointers
|
||||
//
|
||||
Status = CommandInit ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// parse the command line
|
||||
//
|
||||
Status = ShellCommandLineParse (LsParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"ls", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
ShellStatus = MainCmdLs (Package);
|
||||
|
||||
//
|
||||
// Free memory allocated
|
||||
//
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
|
||||
return (ShellStatus);
|
||||
|
|
|
|||
|
|
@ -1093,22 +1093,17 @@ ProbeForMediaChange (
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Function for 'map' command.
|
||||
/** Main function of the 'Map' command.
|
||||
|
||||
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||
@param[in] Package List of input parameter for the command.
|
||||
**/
|
||||
STATIC
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunMap (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
MainCmdMap (
|
||||
LIST_ENTRY *Package
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
CONST CHAR16 *SName;
|
||||
CONST CHAR16 *Mapping;
|
||||
EFI_HANDLE MapAsHandle;
|
||||
|
|
@ -1120,36 +1115,10 @@ ShellCommandRunMap (
|
|||
CONST CHAR16 *TypeString;
|
||||
UINTN TempStringLength;
|
||||
|
||||
ProblemParam = NULL;
|
||||
Mapping = NULL;
|
||||
SName = NULL;
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
MapAsHandle = NULL;
|
||||
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = CommandInit ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// parse the command line
|
||||
//
|
||||
Status = ShellCommandLineParse (MapParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"map", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
Mapping = NULL;
|
||||
SName = NULL;
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
MapAsHandle = NULL;
|
||||
|
||||
//
|
||||
// check for "-?"
|
||||
|
|
@ -1359,6 +1328,57 @@ ShellCommandRunMap (
|
|||
} // we are adding a mapping
|
||||
} // got valid parameters
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
Function for 'map' command.
|
||||
|
||||
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||
**/
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunMap (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
|
||||
ProblemParam = NULL;
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = CommandInit ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// parse the command line
|
||||
//
|
||||
Status = ShellCommandLineParse (MapParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"map", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
ShellStatus = MainCmdMap (Package);
|
||||
|
||||
//
|
||||
// free the command line package
|
||||
//
|
||||
|
|
|
|||
|
|
@ -9,17 +9,14 @@
|
|||
|
||||
#include "UefiShellLevel2CommandsLib.h"
|
||||
|
||||
/**
|
||||
Function for 'mkdir' command.
|
||||
/** Main function of the 'MkDir' command.
|
||||
|
||||
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||
@param[in] Package List of input parameter for the command.
|
||||
**/
|
||||
STATIC
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunMkDir (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
MainCmdMkdir (
|
||||
LIST_ENTRY *Package
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
|
@ -28,8 +25,6 @@ ShellCommandRunMkDir (
|
|||
CHAR16 *SplitName;
|
||||
CHAR16 SaveSplitChar;
|
||||
UINTN DirCreateCount;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_FILE_HANDLE FileHandle;
|
||||
SHELL_STATUS ShellStatus;
|
||||
|
||||
|
|
@ -37,33 +32,14 @@ ShellCommandRunMkDir (
|
|||
NewDirNameCopy = NULL;
|
||||
SplitName = NULL;
|
||||
SaveSplitChar = CHAR_NULL;
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// parse the command line
|
||||
//
|
||||
Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"mkdir", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
//
|
||||
// check for "-?"
|
||||
//
|
||||
if (ShellCommandLineGetFlag (Package, L"-?")) {
|
||||
ASSERT (FALSE);
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
//
|
||||
|
|
@ -163,6 +139,54 @@ ShellCommandRunMkDir (
|
|||
}
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
Function for 'mkdir' command.
|
||||
|
||||
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||
**/
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunMkDir (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
|
||||
ProblemParam = NULL;
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// parse the command line
|
||||
//
|
||||
Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"mkdir", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
ShellStatus = MainCmdMkdir (Package);
|
||||
|
||||
//
|
||||
// free the command line package
|
||||
//
|
||||
|
|
|
|||
|
|
@ -740,22 +740,17 @@ ValidateAndMoveFiles (
|
|||
return (ShellStatus);
|
||||
}
|
||||
|
||||
/**
|
||||
Function for 'mv' command.
|
||||
/** Main function of the 'Mv' command.
|
||||
|
||||
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||
@param[in] Package List of input parameter for the command.
|
||||
**/
|
||||
STATIC
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunMv (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
MainCmdMv (
|
||||
LIST_ENTRY *Package
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
CHAR16 *Cwd;
|
||||
UINTN CwdSize;
|
||||
SHELL_STATUS ShellStatus;
|
||||
|
|
@ -764,33 +759,10 @@ ShellCommandRunMv (
|
|||
EFI_SHELL_FILE_INFO *FileList;
|
||||
VOID *Response;
|
||||
|
||||
ProblemParam = NULL;
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
ParamCount = 0;
|
||||
FileList = NULL;
|
||||
Response = NULL;
|
||||
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// parse the command line
|
||||
//
|
||||
Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"mv", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
ParamCount = 0;
|
||||
FileList = NULL;
|
||||
Response = NULL;
|
||||
|
||||
//
|
||||
// check for "-?"
|
||||
|
|
@ -878,13 +850,61 @@ ShellCommandRunMv (
|
|||
ShellCloseFileMetaArg (&FileList);
|
||||
}
|
||||
|
||||
SHELL_FREE_NON_NULL (Response);
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
Function for 'mv' command.
|
||||
|
||||
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||
**/
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunMv (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
|
||||
ProblemParam = NULL;
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// parse the command line
|
||||
//
|
||||
Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"mv", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
ShellStatus = MainCmdMv (Package);
|
||||
|
||||
//
|
||||
// free the command line package
|
||||
//
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
|
||||
SHELL_FREE_NON_NULL (Response);
|
||||
|
||||
if (ShellGetExecutionBreakFlag ()) {
|
||||
return (SHELL_ABORTED);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -234,22 +234,16 @@ STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
|
|||
{ NULL, TypeMax }
|
||||
};
|
||||
|
||||
/**
|
||||
Function for 'parse' command.
|
||||
/** Main function of the 'Parse' command.
|
||||
|
||||
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||
@param[in] Package List of input parameter for the command.
|
||||
**/
|
||||
STATIC
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunParse (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
MainCmdParse (
|
||||
LIST_ENTRY *Package
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
CONST CHAR16 *FileName;
|
||||
CONST CHAR16 *TableName;
|
||||
CONST CHAR16 *ColumnString;
|
||||
|
|
@ -259,31 +253,8 @@ ShellCommandRunParse (
|
|||
BOOLEAN StreamingUnicode;
|
||||
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
ProblemParam = NULL;
|
||||
StreamingUnicode = FALSE;
|
||||
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// parse the command line
|
||||
//
|
||||
Status = ShellCommandLineParseEx (ParamList, &Package, &ProblemParam, TRUE, FALSE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"parse", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
StreamingUnicode = IsStdInDataAvailable ();
|
||||
if ((!StreamingUnicode && (ShellCommandLineGetCount (Package) < 4)) ||
|
||||
(ShellCommandLineGetCount (Package) < 3))
|
||||
|
|
@ -325,6 +296,54 @@ ShellCommandRunParse (
|
|||
}
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
Function for 'parse' command.
|
||||
|
||||
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||
**/
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunParse (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
ProblemParam = NULL;
|
||||
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// parse the command line
|
||||
//
|
||||
Status = ShellCommandLineParseEx (ParamList, &Package, &ProblemParam, TRUE, FALSE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"parse", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
ShellStatus = MainCmdParse (Package);
|
||||
|
||||
//
|
||||
// free the command line package
|
||||
//
|
||||
|
|
|
|||
|
|
@ -17,52 +17,24 @@ STATIC CONST SHELL_PARAM_ITEM ResetParamList[] = {
|
|||
{ NULL, TypeMax }
|
||||
};
|
||||
|
||||
/**
|
||||
Function for 'reset' command.
|
||||
/** Main function of the 'Reset' command.
|
||||
|
||||
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||
@param[in] Package List of input parameter for the command.
|
||||
**/
|
||||
STATIC
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunReset (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
MainCmdReset (
|
||||
LIST_ENTRY *Package
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CONST CHAR16 *String;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
UINT64 OsIndications;
|
||||
UINT32 Attr;
|
||||
UINTN DataSize;
|
||||
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
ProblemParam = NULL;
|
||||
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// parse the command line
|
||||
//
|
||||
Status = ShellCommandLineParse (ResetParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"reset", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
return (SHELL_INVALID_PARAMETER);
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
|
||||
//
|
||||
// check for "-?"
|
||||
|
|
@ -84,8 +56,7 @@ ShellCommandRunReset (
|
|||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
ShellStatus = SHELL_UNSUPPORTED;
|
||||
goto Error;
|
||||
return SHELL_UNSUPPORTED;
|
||||
}
|
||||
|
||||
if ((OsIndications & EFI_OS_INDICATIONS_BOOT_TO_FW_UI) != 0) {
|
||||
|
|
@ -114,8 +85,7 @@ ShellCommandRunReset (
|
|||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
ShellStatus = SHELL_UNSUPPORTED;
|
||||
goto Error;
|
||||
return SHELL_UNSUPPORTED;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -162,12 +132,59 @@ ShellCommandRunReset (
|
|||
}
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
Function for 'reset' command.
|
||||
|
||||
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||
**/
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunReset (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
ProblemParam = NULL;
|
||||
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// parse the command line
|
||||
//
|
||||
Status = ShellCommandLineParse (ResetParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"reset", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
return (SHELL_INVALID_PARAMETER);
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
ShellStatus = MainCmdReset (Package);
|
||||
|
||||
//
|
||||
// we should never get here... so the free and return are for formality more than use
|
||||
// as the ResetSystem function should not return...
|
||||
//
|
||||
|
||||
Error:
|
||||
//
|
||||
// free the command line package
|
||||
//
|
||||
|
|
|
|||
|
|
@ -268,54 +268,26 @@ Done:
|
|||
return (RetVal);
|
||||
}
|
||||
|
||||
/**
|
||||
Function for 'rm' command.
|
||||
/** Main function of the 'Rm' command.
|
||||
|
||||
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||
@param[in] Package List of input parameter for the command.
|
||||
**/
|
||||
STATIC
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunRm (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
MainCmdRm (
|
||||
LIST_ENTRY *Package
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
CONST CHAR16 *Param;
|
||||
SHELL_STATUS ShellStatus;
|
||||
UINTN ParamCount;
|
||||
EFI_SHELL_FILE_INFO *FileList;
|
||||
EFI_SHELL_FILE_INFO *Node;
|
||||
|
||||
ProblemParam = NULL;
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
ParamCount = 0;
|
||||
FileList = NULL;
|
||||
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// parse the command line
|
||||
//
|
||||
Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"rm", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
ParamCount = 0;
|
||||
FileList = NULL;
|
||||
|
||||
//
|
||||
// check for "-?"
|
||||
|
|
@ -393,6 +365,54 @@ ShellCommandRunRm (
|
|||
FileList = NULL;
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
Function for 'rm' command.
|
||||
|
||||
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||
**/
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunRm (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
|
||||
ProblemParam = NULL;
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// parse the command line
|
||||
//
|
||||
Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"rm", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
ShellStatus = MainCmdRm (Package);
|
||||
|
||||
//
|
||||
// free the command line package
|
||||
//
|
||||
|
|
|
|||
|
|
@ -39,62 +39,22 @@ PrintAllShellEnvVars (
|
|||
return (SHELL_SUCCESS);
|
||||
}
|
||||
|
||||
STATIC CONST SHELL_PARAM_ITEM SetParamList[] = {
|
||||
{ L"-d", TypeValue },
|
||||
{ L"-v", TypeFlag },
|
||||
{ NULL, TypeMax }
|
||||
};
|
||||
/** Main function of the 'Set' command.
|
||||
|
||||
/**
|
||||
Function for 'set' command.
|
||||
|
||||
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||
@param[in] Package List of input parameter for the command.
|
||||
**/
|
||||
STATIC
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunSet (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
MainCmdSet (
|
||||
LIST_ENTRY *Package
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CONST CHAR16 *KeyName;
|
||||
CONST CHAR16 *Value;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
|
||||
ProblemParam = NULL;
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// Make sure globals are good...
|
||||
//
|
||||
Status = CommandInit ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// parse the command line
|
||||
//
|
||||
Status = ShellCommandLineParse (SetParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"set", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
return (SHELL_INVALID_PARAMETER);
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
|
||||
//
|
||||
// check for "-?"
|
||||
|
|
@ -161,6 +121,66 @@ ShellCommandRunSet (
|
|||
}
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
STATIC CONST SHELL_PARAM_ITEM SetParamList[] = {
|
||||
{ L"-d", TypeValue },
|
||||
{ L"-v", TypeFlag },
|
||||
{ NULL, TypeMax }
|
||||
};
|
||||
|
||||
/**
|
||||
Function for 'set' command.
|
||||
|
||||
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||
**/
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunSet (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
|
||||
ProblemParam = NULL;
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// Make sure globals are good...
|
||||
//
|
||||
Status = CommandInit ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// parse the command line
|
||||
//
|
||||
Status = ShellCommandLineParse (SetParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"set", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
return (SHELL_INVALID_PARAMETER);
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
ShellStatus = MainCmdSet (Package);
|
||||
|
||||
//
|
||||
// free the command line package
|
||||
//
|
||||
|
|
|
|||
|
|
@ -166,50 +166,22 @@ CheckAndSetDate (
|
|||
return (SHELL_INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
/**
|
||||
Function for 'date' command.
|
||||
/** Main function of the 'Date' command.
|
||||
|
||||
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||
@param[in] Package List of input parameter for the command.
|
||||
**/
|
||||
STATIC
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunDate (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
MainCmdDate (
|
||||
LIST_ENTRY *Package
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
EFI_TIME TheTime;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
CONST CHAR16 *Param1;
|
||||
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
ProblemParam = NULL;
|
||||
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// parse the command line
|
||||
//
|
||||
Status = ShellCommandLineParse (SfoParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"date", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
|
||||
//
|
||||
// check for "-?"
|
||||
|
|
@ -271,6 +243,54 @@ ShellCommandRunDate (
|
|||
}
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
Function for 'date' command.
|
||||
|
||||
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||
**/
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunDate (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
ProblemParam = NULL;
|
||||
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// parse the command line
|
||||
//
|
||||
Status = ShellCommandLineParse (SfoParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"date", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
ShellStatus = MainCmdDate (Package);
|
||||
|
||||
//
|
||||
// free the command line package
|
||||
//
|
||||
|
|
@ -400,62 +420,25 @@ CheckAndSetTime (
|
|||
return (SHELL_INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
/**
|
||||
Function for 'time' command.
|
||||
/** Main function of the 'Time' command.
|
||||
|
||||
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||
@param[in] Package List of input parameter for the command.
|
||||
**/
|
||||
STATIC
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunTime (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
MainCmdTime (
|
||||
LIST_ENTRY *Package
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
EFI_TIME TheTime;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
INT16 Tz;
|
||||
UINT8 Daylight;
|
||||
CONST CHAR16 *TempLocation;
|
||||
UINTN TzMinutes;
|
||||
|
||||
//
|
||||
// Initialize variables
|
||||
//
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
ProblemParam = NULL;
|
||||
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// parse the command line
|
||||
//
|
||||
if (PcdGet8 (PcdShellSupportLevel) == 2) {
|
||||
Status = ShellCommandLineParseEx (TimeParamList2, &Package, &ProblemParam, TRUE, TRUE);
|
||||
} else {
|
||||
ASSERT (PcdGet8 (PcdShellSupportLevel) == 3);
|
||||
Status = ShellCommandLineParseEx (TimeParamList3, &Package, &ProblemParam, TRUE, TRUE);
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"time", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
|
||||
//
|
||||
// check for "-?"
|
||||
|
|
@ -631,6 +614,63 @@ ShellCommandRunTime (
|
|||
}
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
Function for 'time' command.
|
||||
|
||||
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||
**/
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunTime (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
|
||||
//
|
||||
// Initialize variables
|
||||
//
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
ProblemParam = NULL;
|
||||
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// parse the command line
|
||||
//
|
||||
if (PcdGet8 (PcdShellSupportLevel) == 2) {
|
||||
Status = ShellCommandLineParseEx (TimeParamList2, &Package, &ProblemParam, TRUE, TRUE);
|
||||
} else {
|
||||
ASSERT (PcdGet8 (PcdShellSupportLevel) == 3);
|
||||
Status = ShellCommandLineParseEx (TimeParamList3, &Package, &ProblemParam, TRUE, TRUE);
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"time", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
ShellStatus = MainCmdTime (Package);
|
||||
|
||||
//
|
||||
// free the command line package
|
||||
//
|
||||
|
|
@ -802,61 +842,24 @@ CheckAndSetTimeZone (
|
|||
return (SHELL_INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
/**
|
||||
Function for 'timezone' command.
|
||||
/** Main function of the 'TimeZone' command.
|
||||
|
||||
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||
@param[in] Package List of input parameter for the command.
|
||||
**/
|
||||
STATIC
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunTimeZone (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
MainCmdTimeZone (
|
||||
LIST_ENTRY *Package
|
||||
)
|
||||
{
|
||||
//
|
||||
// non interactive
|
||||
//
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
UINT8 LoopVar;
|
||||
EFI_TIME TheTime;
|
||||
BOOLEAN Found;
|
||||
UINTN TzMinutes;
|
||||
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
ProblemParam = NULL;
|
||||
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// parse the command line
|
||||
//
|
||||
if (PcdGet8 (PcdShellSupportLevel) == 2) {
|
||||
Status = ShellCommandLineParse (TimeZoneParamList2, &Package, &ProblemParam, TRUE);
|
||||
} else {
|
||||
ASSERT (PcdGet8 (PcdShellSupportLevel) == 3);
|
||||
Status = ShellCommandLineParseEx (TimeZoneParamList3, &Package, &ProblemParam, TRUE, TRUE);
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"timezone", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
|
||||
//
|
||||
// check for "-?"
|
||||
|
|
@ -985,6 +988,63 @@ ShellCommandRunTimeZone (
|
|||
}
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
Function for 'timezone' command.
|
||||
|
||||
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||
**/
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunTimeZone (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
//
|
||||
// non interactive
|
||||
//
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
ProblemParam = NULL;
|
||||
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// parse the command line
|
||||
//
|
||||
if (PcdGet8 (PcdShellSupportLevel) == 2) {
|
||||
Status = ShellCommandLineParse (TimeZoneParamList2, &Package, &ProblemParam, TRUE);
|
||||
} else {
|
||||
ASSERT (PcdGet8 (PcdShellSupportLevel) == 3);
|
||||
Status = ShellCommandLineParseEx (TimeZoneParamList3, &Package, &ProblemParam, TRUE, TRUE);
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"timezone", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
ShellStatus = MainCmdTimeZone (Package);
|
||||
|
||||
//
|
||||
// free the command line package
|
||||
//
|
||||
|
|
|
|||
|
|
@ -198,28 +198,16 @@ HandleVol (
|
|||
return (ShellStatus);
|
||||
}
|
||||
|
||||
STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
|
||||
{ L"-d", TypeFlag },
|
||||
{ L"-n", TypeValue },
|
||||
{ NULL, TypeMax }
|
||||
};
|
||||
/** Main function of the 'Vol' command.
|
||||
|
||||
/**
|
||||
Function for 'Vol' command.
|
||||
|
||||
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||
@param[in] Package List of input parameter for the command.
|
||||
**/
|
||||
STATIC
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunVol (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
MainCmdVol (
|
||||
LIST_ENTRY *Package
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
CONST CHAR16 *PathName;
|
||||
CONST CHAR16 *CurDir;
|
||||
|
|
@ -229,40 +217,11 @@ ShellCommandRunVol (
|
|||
UINTN Length;
|
||||
CONST CHAR16 *NewName;
|
||||
|
||||
Length = 0;
|
||||
ProblemParam = NULL;
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
PathName = NULL;
|
||||
CurDir = NULL;
|
||||
FullPath = NULL;
|
||||
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// Fix local copies of the protocol pointers
|
||||
//
|
||||
Status = CommandInit ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// parse the command line
|
||||
//
|
||||
Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"vol", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
Length = 0;
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
PathName = NULL;
|
||||
CurDir = NULL;
|
||||
FullPath = NULL;
|
||||
|
||||
//
|
||||
// check for "-?"
|
||||
|
|
@ -322,6 +281,66 @@ ShellCommandRunVol (
|
|||
|
||||
SHELL_FREE_NON_NULL (FullPath);
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
|
||||
{ L"-d", TypeFlag },
|
||||
{ L"-n", TypeValue },
|
||||
{ NULL, TypeMax }
|
||||
};
|
||||
|
||||
/**
|
||||
Function for 'Vol' command.
|
||||
|
||||
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||
**/
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunVol (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
|
||||
ProblemParam = NULL;
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// Fix local copies of the protocol pointers
|
||||
//
|
||||
Status = CommandInit ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// parse the command line
|
||||
//
|
||||
Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"vol", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
ShellStatus = MainCmdVol (Package);
|
||||
|
||||
//
|
||||
// free the command line package
|
||||
//
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue