ShellPkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the ShellPkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
This commit is contained in:
committed by
mergify[bot]
parent
c411b485b6
commit
47d20b54f9
@ -31,64 +31,65 @@
|
||||
@retval EFI_SUCCESS the operation was successful.
|
||||
**/
|
||||
EFI_STATUS
|
||||
LexicalInsertIntoList(
|
||||
IN OUT CHAR16 **DestList,
|
||||
IN OUT UINTN *DestSize,
|
||||
IN CONST CHAR16 *Item
|
||||
LexicalInsertIntoList (
|
||||
IN OUT CHAR16 **DestList,
|
||||
IN OUT UINTN *DestSize,
|
||||
IN CONST CHAR16 *Item
|
||||
)
|
||||
{
|
||||
CHAR16 *NewList;
|
||||
INTN LexicalMatchValue;
|
||||
CHAR16 *LexicalSpot;
|
||||
UINTN SizeOfAddedNameInBytes;
|
||||
CHAR16 *NewList;
|
||||
INTN LexicalMatchValue;
|
||||
CHAR16 *LexicalSpot;
|
||||
UINTN SizeOfAddedNameInBytes;
|
||||
|
||||
//
|
||||
// If there are none, then just return with success
|
||||
//
|
||||
if (Item == NULL || *Item == CHAR_NULL || StrLen(Item)==0) {
|
||||
if ((Item == NULL) || (*Item == CHAR_NULL) || (StrLen (Item) == 0)) {
|
||||
return (EFI_SUCCESS);
|
||||
}
|
||||
|
||||
NewList = *DestList;
|
||||
|
||||
SizeOfAddedNameInBytes = StrSize(Item);
|
||||
NewList = ReallocatePool(*DestSize, (*DestSize) + SizeOfAddedNameInBytes, NewList);
|
||||
(*DestSize) = (*DestSize) + SizeOfAddedNameInBytes;
|
||||
SizeOfAddedNameInBytes = StrSize (Item);
|
||||
NewList = ReallocatePool (*DestSize, (*DestSize) + SizeOfAddedNameInBytes, NewList);
|
||||
(*DestSize) = (*DestSize) + SizeOfAddedNameInBytes;
|
||||
|
||||
//
|
||||
// Find the correct spot in the list
|
||||
//
|
||||
for (LexicalSpot = NewList
|
||||
; LexicalSpot != NULL && LexicalSpot < NewList + (*DestSize)
|
||||
; LexicalSpot += StrLen(LexicalSpot) + 1
|
||||
) {
|
||||
; LexicalSpot != NULL && LexicalSpot < NewList + (*DestSize)
|
||||
; LexicalSpot += StrLen (LexicalSpot) + 1
|
||||
)
|
||||
{
|
||||
//
|
||||
// Get Lexical Comparison Value between PrevCommand and Command list entry
|
||||
//
|
||||
LexicalMatchValue = gUnicodeCollation->StriColl (
|
||||
gUnicodeCollation,
|
||||
(CHAR16 *)LexicalSpot,
|
||||
(CHAR16 *)Item
|
||||
);
|
||||
gUnicodeCollation,
|
||||
(CHAR16 *)LexicalSpot,
|
||||
(CHAR16 *)Item
|
||||
);
|
||||
//
|
||||
// The new item goes before this one.
|
||||
//
|
||||
if (LexicalMatchValue > 0 || StrLen(LexicalSpot) == 0) {
|
||||
if (StrLen(LexicalSpot) != 0) {
|
||||
if ((LexicalMatchValue > 0) || (StrLen (LexicalSpot) == 0)) {
|
||||
if (StrLen (LexicalSpot) != 0) {
|
||||
//
|
||||
// Move this and all other items out of the way
|
||||
//
|
||||
CopyMem(
|
||||
LexicalSpot + (SizeOfAddedNameInBytes/sizeof(CHAR16)),
|
||||
CopyMem (
|
||||
LexicalSpot + (SizeOfAddedNameInBytes/sizeof (CHAR16)),
|
||||
LexicalSpot,
|
||||
(*DestSize) - SizeOfAddedNameInBytes - ((LexicalSpot - NewList) * sizeof(CHAR16))
|
||||
(*DestSize) - SizeOfAddedNameInBytes - ((LexicalSpot - NewList) * sizeof (CHAR16))
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Stick this one in place
|
||||
//
|
||||
StrCpyS(LexicalSpot, SizeOfAddedNameInBytes/sizeof(CHAR16), Item);
|
||||
StrCpyS (LexicalSpot, SizeOfAddedNameInBytes/sizeof (CHAR16), Item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -109,20 +110,22 @@ LexicalInsertIntoList(
|
||||
@retval EFI_SUCCESS the operation was successful.
|
||||
**/
|
||||
EFI_STATUS
|
||||
CopyListOfCommandNames(
|
||||
IN OUT CHAR16 **DestList,
|
||||
IN OUT UINTN *DestSize,
|
||||
IN CONST COMMAND_LIST *SourceList
|
||||
CopyListOfCommandNames (
|
||||
IN OUT CHAR16 **DestList,
|
||||
IN OUT UINTN *DestSize,
|
||||
IN CONST COMMAND_LIST *SourceList
|
||||
)
|
||||
{
|
||||
CONST COMMAND_LIST *Node;
|
||||
|
||||
for ( Node = (COMMAND_LIST*)GetFirstNode(&SourceList->Link)
|
||||
; SourceList != NULL && !IsListEmpty(&SourceList->Link) && !IsNull(&SourceList->Link, &Node->Link)
|
||||
; Node = (COMMAND_LIST*)GetNextNode(&SourceList->Link, &Node->Link)
|
||||
) {
|
||||
LexicalInsertIntoList(DestList, DestSize, Node->CommandString);
|
||||
for ( Node = (COMMAND_LIST *)GetFirstNode (&SourceList->Link)
|
||||
; SourceList != NULL && !IsListEmpty (&SourceList->Link) && !IsNull (&SourceList->Link, &Node->Link)
|
||||
; Node = (COMMAND_LIST *)GetNextNode (&SourceList->Link, &Node->Link)
|
||||
)
|
||||
{
|
||||
LexicalInsertIntoList (DestList, DestSize, Node->CommandString);
|
||||
}
|
||||
|
||||
return (EFI_SUCCESS);
|
||||
}
|
||||
|
||||
@ -139,9 +142,9 @@ CopyListOfCommandNames(
|
||||
**/
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
CopyListOfCommandNamesWithDynamic(
|
||||
IN OUT CHAR16** DestList,
|
||||
IN OUT UINTN *DestSize
|
||||
CopyListOfCommandNamesWithDynamic (
|
||||
IN OUT CHAR16 **DestList,
|
||||
IN OUT UINTN *DestSize
|
||||
)
|
||||
{
|
||||
EFI_HANDLE *CommandHandleList;
|
||||
@ -149,7 +152,7 @@ CopyListOfCommandNamesWithDynamic(
|
||||
EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *DynamicCommand;
|
||||
EFI_STATUS Status;
|
||||
|
||||
CommandHandleList = GetHandleListByProtocol(&gEfiShellDynamicCommandProtocolGuid);
|
||||
CommandHandleList = GetHandleListByProtocol (&gEfiShellDynamicCommandProtocolGuid);
|
||||
|
||||
//
|
||||
// If there are none, then just return with success
|
||||
@ -163,25 +166,24 @@ CopyListOfCommandNamesWithDynamic(
|
||||
//
|
||||
// Append those to the list.
|
||||
//
|
||||
for (NextCommand = CommandHandleList ; *NextCommand != NULL && !EFI_ERROR(Status) ; NextCommand++) {
|
||||
Status = gBS->HandleProtocol(
|
||||
*NextCommand,
|
||||
&gEfiShellDynamicCommandProtocolGuid,
|
||||
(VOID **)&DynamicCommand
|
||||
);
|
||||
for (NextCommand = CommandHandleList; *NextCommand != NULL && !EFI_ERROR (Status); NextCommand++) {
|
||||
Status = gBS->HandleProtocol (
|
||||
*NextCommand,
|
||||
&gEfiShellDynamicCommandProtocolGuid,
|
||||
(VOID **)&DynamicCommand
|
||||
);
|
||||
|
||||
if (EFI_ERROR(Status)) {
|
||||
if (EFI_ERROR (Status)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Status = LexicalInsertIntoList(DestList, DestSize, DynamicCommand->CommandName);
|
||||
Status = LexicalInsertIntoList (DestList, DestSize, DynamicCommand->CommandName);
|
||||
}
|
||||
|
||||
SHELL_FREE_NON_NULL(CommandHandleList);
|
||||
SHELL_FREE_NON_NULL (CommandHandleList);
|
||||
return (Status);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Attempt to print help from a dynamically added command.
|
||||
|
||||
@ -196,11 +198,11 @@ CopyListOfCommandNamesWithDynamic(
|
||||
@retval EFI_DEVICE_ERROR The help data format was incorrect.
|
||||
**/
|
||||
EFI_STATUS
|
||||
PrintDynamicCommandHelp(
|
||||
PrintDynamicCommandHelp (
|
||||
IN CONST CHAR16 *CommandToGetHelpOn,
|
||||
IN CONST CHAR16 *SectionToGetHelpOn,
|
||||
IN BOOLEAN PrintCommandText
|
||||
)
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
BOOLEAN Found;
|
||||
@ -208,11 +210,11 @@ PrintDynamicCommandHelp(
|
||||
EFI_HANDLE *NextCommand;
|
||||
EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *DynamicCommand;
|
||||
|
||||
Status = EFI_NOT_FOUND;
|
||||
Found = FALSE;
|
||||
Status = EFI_NOT_FOUND;
|
||||
Found = FALSE;
|
||||
CommandHandleList = NULL;
|
||||
|
||||
CommandHandleList = GetHandleListByProtocol(&gEfiShellDynamicCommandProtocolGuid);
|
||||
CommandHandleList = GetHandleListByProtocol (&gEfiShellDynamicCommandProtocolGuid);
|
||||
|
||||
if (CommandHandleList == NULL) {
|
||||
//
|
||||
@ -222,13 +224,13 @@ PrintDynamicCommandHelp(
|
||||
}
|
||||
|
||||
for (NextCommand = CommandHandleList; *NextCommand != NULL; NextCommand++) {
|
||||
Status = gBS->HandleProtocol(
|
||||
*NextCommand,
|
||||
&gEfiShellDynamicCommandProtocolGuid,
|
||||
(VOID **)&DynamicCommand
|
||||
);
|
||||
Status = gBS->HandleProtocol (
|
||||
*NextCommand,
|
||||
&gEfiShellDynamicCommandProtocolGuid,
|
||||
(VOID **)&DynamicCommand
|
||||
);
|
||||
|
||||
if (EFI_ERROR(Status)) {
|
||||
if (EFI_ERROR (Status)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -239,36 +241,51 @@ PrintDynamicCommandHelp(
|
||||
break;
|
||||
}
|
||||
|
||||
if ((gUnicodeCollation->MetaiMatch (gUnicodeCollation, (CHAR16 *)DynamicCommand->CommandName, (CHAR16*)CommandToGetHelpOn)) ||
|
||||
(gEfiShellProtocol->GetAlias (CommandToGetHelpOn, NULL) != NULL && (gUnicodeCollation->MetaiMatch (gUnicodeCollation, (CHAR16 *)DynamicCommand->CommandName, (CHAR16*)(gEfiShellProtocol->GetAlias(CommandToGetHelpOn, NULL)))))) {
|
||||
if ((gUnicodeCollation->MetaiMatch (gUnicodeCollation, (CHAR16 *)DynamicCommand->CommandName, (CHAR16 *)CommandToGetHelpOn)) ||
|
||||
((gEfiShellProtocol->GetAlias (CommandToGetHelpOn, NULL) != NULL) && (gUnicodeCollation->MetaiMatch (gUnicodeCollation, (CHAR16 *)DynamicCommand->CommandName, (CHAR16 *)(gEfiShellProtocol->GetAlias (CommandToGetHelpOn, NULL))))))
|
||||
{
|
||||
// Print as Shell Help if in ManPage format.
|
||||
Status = ShellPrintHelp (DynamicCommand->CommandName, SectionToGetHelpOn,
|
||||
PrintCommandText);
|
||||
Status = ShellPrintHelp (
|
||||
DynamicCommand->CommandName,
|
||||
SectionToGetHelpOn,
|
||||
PrintCommandText
|
||||
);
|
||||
if (Status == EFI_DEVICE_ERROR) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HELP_INV),
|
||||
gShellLevel3HiiHandle, DynamicCommand->CommandName);
|
||||
} else if (EFI_ERROR(Status)) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HELP_NF),
|
||||
gShellLevel3HiiHandle, DynamicCommand->CommandName);
|
||||
ShellPrintHiiEx (
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_HELP_INV),
|
||||
gShellLevel3HiiHandle,
|
||||
DynamicCommand->CommandName
|
||||
);
|
||||
} else if (EFI_ERROR (Status)) {
|
||||
ShellPrintHiiEx (
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_HELP_NF),
|
||||
gShellLevel3HiiHandle,
|
||||
DynamicCommand->CommandName
|
||||
);
|
||||
} else {
|
||||
Found = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SHELL_FREE_NON_NULL(CommandHandleList);
|
||||
SHELL_FREE_NON_NULL (CommandHandleList);
|
||||
|
||||
return (Found ? EFI_SUCCESS : Status);
|
||||
|
||||
}
|
||||
|
||||
STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
|
||||
{L"-usage", TypeFlag},
|
||||
{L"-section", TypeMaxValue},
|
||||
{L"-verbose", TypeFlag},
|
||||
{L"-v", TypeFlag},
|
||||
{NULL, TypeMax}
|
||||
};
|
||||
STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
|
||||
{ L"-usage", TypeFlag },
|
||||
{ L"-section", TypeMaxValue },
|
||||
{ L"-verbose", TypeFlag },
|
||||
{ L"-v", TypeFlag },
|
||||
{ NULL, TypeMax }
|
||||
};
|
||||
|
||||
/**
|
||||
Function for 'help' command.
|
||||
@ -283,90 +300,91 @@ ShellCommandRunHelp (
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
CHAR16 *SortedCommandList;
|
||||
CONST CHAR16 *CurrentCommand;
|
||||
CHAR16 *CommandToGetHelpOn;
|
||||
CHAR16 *SectionToGetHelpOn;
|
||||
CHAR16 *HiiString;
|
||||
BOOLEAN Found;
|
||||
BOOLEAN PrintCommandText;
|
||||
UINTN SortedCommandListSize;
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
CHAR16 *SortedCommandList;
|
||||
CONST CHAR16 *CurrentCommand;
|
||||
CHAR16 *CommandToGetHelpOn;
|
||||
CHAR16 *SectionToGetHelpOn;
|
||||
CHAR16 *HiiString;
|
||||
BOOLEAN Found;
|
||||
BOOLEAN PrintCommandText;
|
||||
UINTN SortedCommandListSize;
|
||||
|
||||
PrintCommandText = TRUE;
|
||||
ProblemParam = NULL;
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
CommandToGetHelpOn = NULL;
|
||||
SectionToGetHelpOn = NULL;
|
||||
SortedCommandList = NULL;
|
||||
Found = FALSE;
|
||||
PrintCommandText = TRUE;
|
||||
ProblemParam = NULL;
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
CommandToGetHelpOn = NULL;
|
||||
SectionToGetHelpOn = NULL;
|
||||
SortedCommandList = NULL;
|
||||
Found = FALSE;
|
||||
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize();
|
||||
ASSERT_EFI_ERROR(Status);
|
||||
Status = ShellInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = CommandInit();
|
||||
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) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel3HiiHandle, L"help", ProblemParam);
|
||||
FreePool(ProblemParam);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel3HiiHandle, L"help", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT(FALSE);
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
} else {
|
||||
//
|
||||
// Check for conflicting parameters.
|
||||
//
|
||||
if (ShellCommandLineGetFlag(Package, L"-usage")
|
||||
&&ShellCommandLineGetFlag(Package, L"-section")
|
||||
&&(ShellCommandLineGetFlag(Package, L"-verbose") || ShellCommandLineGetFlag(Package, L"-v"))
|
||||
){
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CON), gShellLevel3HiiHandle, L"help");
|
||||
if ( ShellCommandLineGetFlag (Package, L"-usage")
|
||||
&& ShellCommandLineGetFlag (Package, L"-section")
|
||||
&& (ShellCommandLineGetFlag (Package, L"-verbose") || ShellCommandLineGetFlag (Package, L"-v"))
|
||||
)
|
||||
{
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CON), gShellLevel3HiiHandle, L"help");
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else if (ShellCommandLineGetRawValue(Package, 2) != NULL) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel3HiiHandle, L"help");
|
||||
} else if (ShellCommandLineGetRawValue (Package, 2) != NULL) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel3HiiHandle, L"help");
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
//
|
||||
// Get the command name we are getting help on
|
||||
//
|
||||
ASSERT(CommandToGetHelpOn == NULL);
|
||||
StrnCatGrow(&CommandToGetHelpOn, NULL, ShellCommandLineGetRawValue(Package, 1), 0);
|
||||
if (CommandToGetHelpOn == NULL && ShellCommandLineGetFlag(Package, L"-?")) {
|
||||
ASSERT (CommandToGetHelpOn == NULL);
|
||||
StrnCatGrow (&CommandToGetHelpOn, NULL, ShellCommandLineGetRawValue (Package, 1), 0);
|
||||
if ((CommandToGetHelpOn == NULL) && ShellCommandLineGetFlag (Package, L"-?")) {
|
||||
//
|
||||
// If we dont have a command and we got a simple -?
|
||||
// we are looking for help on help command.
|
||||
//
|
||||
StrnCatGrow(&CommandToGetHelpOn, NULL, L"help", 0);
|
||||
StrnCatGrow (&CommandToGetHelpOn, NULL, L"help", 0);
|
||||
}
|
||||
|
||||
if (CommandToGetHelpOn == NULL) {
|
||||
StrnCatGrow(&CommandToGetHelpOn, NULL, L"*", 0);
|
||||
ASSERT(SectionToGetHelpOn == NULL);
|
||||
StrnCatGrow(&SectionToGetHelpOn, NULL, L"NAME", 0);
|
||||
StrnCatGrow (&CommandToGetHelpOn, NULL, L"*", 0);
|
||||
ASSERT (SectionToGetHelpOn == NULL);
|
||||
StrnCatGrow (&SectionToGetHelpOn, NULL, L"NAME", 0);
|
||||
} else {
|
||||
PrintCommandText = FALSE;
|
||||
ASSERT(SectionToGetHelpOn == NULL);
|
||||
ASSERT (SectionToGetHelpOn == NULL);
|
||||
//
|
||||
// Get the section name for the given command name
|
||||
//
|
||||
if (ShellCommandLineGetFlag(Package, L"-section")) {
|
||||
StrnCatGrow(&SectionToGetHelpOn, NULL, ShellCommandLineGetValue(Package, L"-section"), 0);
|
||||
} else if (ShellCommandLineGetFlag(Package, L"-usage")) {
|
||||
StrnCatGrow(&SectionToGetHelpOn, NULL, L"NAME,SYNOPSIS", 0);
|
||||
} else if (ShellCommandLineGetFlag(Package, L"-verbose") || ShellCommandLineGetFlag(Package, L"-v")) {
|
||||
if (ShellCommandLineGetFlag (Package, L"-section")) {
|
||||
StrnCatGrow (&SectionToGetHelpOn, NULL, ShellCommandLineGetValue (Package, L"-section"), 0);
|
||||
} else if (ShellCommandLineGetFlag (Package, L"-usage")) {
|
||||
StrnCatGrow (&SectionToGetHelpOn, NULL, L"NAME,SYNOPSIS", 0);
|
||||
} else if (ShellCommandLineGetFlag (Package, L"-verbose") || ShellCommandLineGetFlag (Package, L"-v")) {
|
||||
} else {
|
||||
//
|
||||
// The output of help <command> will display NAME, SYNOPSIS, OPTIONS, DESCRIPTION, and EXAMPLES sections.
|
||||
@ -375,25 +393,26 @@ ShellCommandRunHelp (
|
||||
}
|
||||
}
|
||||
|
||||
if (gUnicodeCollation->StriColl(gUnicodeCollation, CommandToGetHelpOn, L"special") == 0) {
|
||||
if (gUnicodeCollation->StriColl (gUnicodeCollation, CommandToGetHelpOn, L"special") == 0) {
|
||||
//
|
||||
// we need info on the special characters
|
||||
//
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HELP_SC_HEADER), gShellLevel3HiiHandle);
|
||||
HiiString = HiiGetString(gShellLevel3HiiHandle, STRING_TOKEN(STR_HELP_SC_DATA), NULL);
|
||||
ShellPrintEx(-1, -1, L"%s", HiiString);
|
||||
FreePool(HiiString);
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HELP_SC_HEADER), gShellLevel3HiiHandle);
|
||||
HiiString = HiiGetString (gShellLevel3HiiHandle, STRING_TOKEN (STR_HELP_SC_DATA), NULL);
|
||||
ShellPrintEx (-1, -1, L"%s", HiiString);
|
||||
FreePool (HiiString);
|
||||
Found = TRUE;
|
||||
} else {
|
||||
SortedCommandList = NULL;
|
||||
SortedCommandList = NULL;
|
||||
SortedCommandListSize = 0;
|
||||
CopyListOfCommandNames(&SortedCommandList, &SortedCommandListSize, ShellCommandGetCommandList(TRUE));
|
||||
CopyListOfCommandNamesWithDynamic(&SortedCommandList, &SortedCommandListSize);
|
||||
CopyListOfCommandNames (&SortedCommandList, &SortedCommandListSize, ShellCommandGetCommandList (TRUE));
|
||||
CopyListOfCommandNamesWithDynamic (&SortedCommandList, &SortedCommandListSize);
|
||||
|
||||
for (CurrentCommand = SortedCommandList
|
||||
; CurrentCommand != NULL && CurrentCommand < SortedCommandList + SortedCommandListSize/sizeof(CHAR16) && *CurrentCommand != CHAR_NULL
|
||||
; CurrentCommand += StrLen(CurrentCommand) + 1
|
||||
) {
|
||||
; CurrentCommand != NULL && CurrentCommand < SortedCommandList + SortedCommandListSize/sizeof (CHAR16) && *CurrentCommand != CHAR_NULL
|
||||
; CurrentCommand += StrLen (CurrentCommand) + 1
|
||||
)
|
||||
{
|
||||
//
|
||||
// Checking execution break flag when print multiple command help information.
|
||||
//
|
||||
@ -401,24 +420,26 @@ ShellCommandRunHelp (
|
||||
break;
|
||||
}
|
||||
|
||||
if ((gUnicodeCollation->MetaiMatch(gUnicodeCollation, (CHAR16*)CurrentCommand, CommandToGetHelpOn)) ||
|
||||
(gEfiShellProtocol->GetAlias(CommandToGetHelpOn, NULL) != NULL && (gUnicodeCollation->MetaiMatch(gUnicodeCollation, (CHAR16*)CurrentCommand, (CHAR16*)(gEfiShellProtocol->GetAlias(CommandToGetHelpOn, NULL)))))) {
|
||||
if ((gUnicodeCollation->MetaiMatch (gUnicodeCollation, (CHAR16 *)CurrentCommand, CommandToGetHelpOn)) ||
|
||||
((gEfiShellProtocol->GetAlias (CommandToGetHelpOn, NULL) != NULL) && (gUnicodeCollation->MetaiMatch (gUnicodeCollation, (CHAR16 *)CurrentCommand, (CHAR16 *)(gEfiShellProtocol->GetAlias (CommandToGetHelpOn, NULL))))))
|
||||
{
|
||||
//
|
||||
// We have a command to look for help on.
|
||||
//
|
||||
Status = ShellPrintHelp(CurrentCommand, SectionToGetHelpOn, PrintCommandText);
|
||||
if (EFI_ERROR(Status)) {
|
||||
Status = ShellPrintHelp (CurrentCommand, SectionToGetHelpOn, PrintCommandText);
|
||||
if (EFI_ERROR (Status)) {
|
||||
//
|
||||
// now try to match against the dynamic command list and print help
|
||||
//
|
||||
Status = PrintDynamicCommandHelp (CurrentCommand, SectionToGetHelpOn, PrintCommandText);
|
||||
}
|
||||
|
||||
if (Status == EFI_DEVICE_ERROR) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HELP_INV), gShellLevel3HiiHandle, CurrentCommand);
|
||||
} else if (EFI_ERROR(Status)) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HELP_NF), gShellLevel3HiiHandle, CurrentCommand);
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HELP_INV), gShellLevel3HiiHandle, CurrentCommand);
|
||||
} else if (EFI_ERROR (Status)) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HELP_NF), gShellLevel3HiiHandle, CurrentCommand);
|
||||
} else {
|
||||
Found = TRUE;
|
||||
Found = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -427,11 +448,11 @@ ShellCommandRunHelp (
|
||||
// Search the .man file for Shell applications (Shell external commands).
|
||||
//
|
||||
if (!Found) {
|
||||
Status = ShellPrintHelp(CommandToGetHelpOn, SectionToGetHelpOn, FALSE);
|
||||
Status = ShellPrintHelp (CommandToGetHelpOn, SectionToGetHelpOn, FALSE);
|
||||
if (Status == EFI_DEVICE_ERROR) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HELP_INV), gShellLevel3HiiHandle, CommandToGetHelpOn);
|
||||
} else if (EFI_ERROR(Status)) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HELP_NF), gShellLevel3HiiHandle, CommandToGetHelpOn);
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HELP_INV), gShellLevel3HiiHandle, CommandToGetHelpOn);
|
||||
} else if (EFI_ERROR (Status)) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HELP_NF), gShellLevel3HiiHandle, CommandToGetHelpOn);
|
||||
} else {
|
||||
Found = TRUE;
|
||||
}
|
||||
@ -449,20 +470,23 @@ ShellCommandRunHelp (
|
||||
}
|
||||
}
|
||||
|
||||
if (CommandToGetHelpOn != NULL && StrCmp(CommandToGetHelpOn, L"*") == 0){
|
||||
if ((CommandToGetHelpOn != NULL) && (StrCmp (CommandToGetHelpOn, L"*") == 0)) {
|
||||
//
|
||||
// If '*' then the command entered was 'Help' without qualifiers, This footer
|
||||
// provides additional info on help switches
|
||||
//
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HELP_FOOTER), gShellLevel3HiiHandle);
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HELP_FOOTER), gShellLevel3HiiHandle);
|
||||
}
|
||||
|
||||
if (CommandToGetHelpOn != NULL) {
|
||||
FreePool(CommandToGetHelpOn);
|
||||
FreePool (CommandToGetHelpOn);
|
||||
}
|
||||
|
||||
if (SectionToGetHelpOn != NULL) {
|
||||
FreePool(SectionToGetHelpOn);
|
||||
FreePool (SectionToGetHelpOn);
|
||||
}
|
||||
SHELL_FREE_NON_NULL(SortedCommandList);
|
||||
|
||||
SHELL_FREE_NON_NULL (SortedCommandList);
|
||||
|
||||
return (ShellStatus);
|
||||
}
|
||||
|
Reference in New Issue
Block a user