ShellPkg: Updates to 'help' command
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Chris Phillips <chrisp@hp.com> reviewed-by: Jaben Carsey <jaben.carsey@intel.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13997 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -334,6 +334,16 @@ ShellCommandRegisterCommandName (
|
||||
)
|
||||
{
|
||||
SHELL_COMMAND_INTERNAL_LIST_ENTRY *Node;
|
||||
SHELL_COMMAND_INTERNAL_LIST_ENTRY *Command;
|
||||
SHELL_COMMAND_INTERNAL_LIST_ENTRY *PrevCommand;
|
||||
INTN LexicalMatchValue;
|
||||
|
||||
//
|
||||
// Initialize local variables.
|
||||
//
|
||||
Command = NULL;
|
||||
PrevCommand = NULL;
|
||||
LexicalMatchValue = 0;
|
||||
|
||||
//
|
||||
// ASSERTs for NULL parameters
|
||||
@ -392,9 +402,40 @@ ShellCommandRegisterCommandName (
|
||||
}
|
||||
|
||||
//
|
||||
// add the new struct to the list
|
||||
// Insert a new entry on top of the list
|
||||
//
|
||||
InsertTailList (&mCommandList.Link, &Node->Link);
|
||||
InsertHeadList (&mCommandList.Link, &Node->Link);
|
||||
|
||||
//
|
||||
// Move a new registered command to its sorted ordered location in the list
|
||||
//
|
||||
for (Command = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetFirstNode (&mCommandList.Link),
|
||||
PrevCommand = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetFirstNode (&mCommandList.Link)
|
||||
; !IsNull (&mCommandList.Link, &Command->Link)
|
||||
; Command = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetNextNode (&mCommandList.Link, &Command->Link)) {
|
||||
|
||||
//
|
||||
// Get Lexical Comparison Value between PrevCommand and Command list entry
|
||||
//
|
||||
LexicalMatchValue = gUnicodeCollation->StriColl (
|
||||
gUnicodeCollation,
|
||||
PrevCommand->CommandString,
|
||||
Command->CommandString
|
||||
);
|
||||
|
||||
//
|
||||
// Swap PrevCommand and Command list entry if PrevCommand list entry
|
||||
// is alphabetically greater than Command list entry
|
||||
//
|
||||
if (LexicalMatchValue > 0){
|
||||
Command = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *) SwapListEntries (&PrevCommand->Link, &Command->Link);
|
||||
} else if (LexicalMatchValue < 0) {
|
||||
//
|
||||
// PrevCommand entry is lexically lower than Command entry
|
||||
//
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return (RETURN_SUCCESS);
|
||||
}
|
||||
|
Reference in New Issue
Block a user