35 IN OUT CHAR16 **DestList,
41 INTN LexicalMatchValue;
43 UINTN SizeOfAddedNameInBytes;
48 if ((Item ==
NULL) || (*Item == CHAR_NULL) || (
StrLen (Item) == 0)) {
54 SizeOfAddedNameInBytes =
StrSize (Item);
55 NewList =
ReallocatePool (*DestSize, (*DestSize) + SizeOfAddedNameInBytes, NewList);
56 (*DestSize) = (*DestSize) + SizeOfAddedNameInBytes;
61 for (LexicalSpot = NewList
62 ; LexicalSpot !=
NULL && LexicalSpot < NewList + (*DestSize)
63 ; LexicalSpot +=
StrLen (LexicalSpot) + 1
69 LexicalMatchValue = gUnicodeCollation->StriColl (
71 (CHAR16 *)LexicalSpot,
77 if ((LexicalMatchValue > 0) || (
StrLen (LexicalSpot) == 0)) {
78 if (
StrLen (LexicalSpot) != 0) {
83 LexicalSpot + (SizeOfAddedNameInBytes/
sizeof (CHAR16)),
85 (*DestSize) - SizeOfAddedNameInBytes - ((LexicalSpot - NewList) *
sizeof (CHAR16))
92 StrCpyS (LexicalSpot, SizeOfAddedNameInBytes/
sizeof (CHAR16), Item);
114 IN OUT CHAR16 **DestList,
146 IN OUT CHAR16 **DestList,
160 if (CommandHandleList ==
NULL) {
169 for (NextCommand = CommandHandleList; *NextCommand !=
NULL && !EFI_ERROR (Status); NextCommand++) {
170 Status =
gBS->HandleProtocol (
172 &gEfiShellDynamicCommandProtocolGuid,
173 (VOID **)&DynamicCommand
176 if (EFI_ERROR (Status)) {
183 SHELL_FREE_NON_NULL (CommandHandleList);
202 IN CONST CHAR16 *CommandToGetHelpOn,
203 IN CONST CHAR16 *SectionToGetHelpOn,
204 IN BOOLEAN PrintCommandText
213 Status = EFI_NOT_FOUND;
215 CommandHandleList =
NULL;
219 if (CommandHandleList ==
NULL) {
226 for (NextCommand = CommandHandleList; *NextCommand !=
NULL; NextCommand++) {
227 Status =
gBS->HandleProtocol (
229 &gEfiShellDynamicCommandProtocolGuid,
230 (VOID **)&DynamicCommand
233 if (EFI_ERROR (Status)) {
244 if ((gUnicodeCollation->MetaiMatch (gUnicodeCollation, (CHAR16 *)DynamicCommand->CommandName, (CHAR16 *)CommandToGetHelpOn)) ||
245 ((gEfiShellProtocol->GetAlias (CommandToGetHelpOn,
NULL) !=
NULL) && (gUnicodeCollation->MetaiMatch (gUnicodeCollation, (CHAR16 *)DynamicCommand->CommandName, (CHAR16 *)(gEfiShellProtocol->GetAlias (CommandToGetHelpOn,
NULL))))))
249 DynamicCommand->CommandName,
253 if (Status == EFI_DEVICE_ERROR) {
259 gShellLevel3HiiHandle,
260 DynamicCommand->CommandName
262 }
else if (EFI_ERROR (Status)) {
268 gShellLevel3HiiHandle,
269 DynamicCommand->CommandName
277 SHELL_FREE_NON_NULL (CommandHandleList);
305 CHAR16 *ProblemParam;
307 CHAR16 *SortedCommandList;
308 CONST CHAR16 *CurrentCommand;
309 CHAR16 *CommandToGetHelpOn;
310 CHAR16 *SectionToGetHelpOn;
312 BOOLEAN PrintCommandText;
313 UINTN SortedCommandListSize;
315 PrintCommandText =
TRUE;
318 CommandToGetHelpOn =
NULL;
319 SectionToGetHelpOn =
NULL;
320 SortedCommandList =
NULL;
336 if (EFI_ERROR (Status)) {
337 if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam !=
NULL)) {
362 ASSERT (CommandToGetHelpOn ==
NULL);
372 if (CommandToGetHelpOn ==
NULL) {
374 ASSERT (SectionToGetHelpOn ==
NULL);
377 PrintCommandText =
FALSE;
378 ASSERT (SectionToGetHelpOn ==
NULL);
391 StrnCatGrow (&SectionToGetHelpOn,
NULL, L
"NAME,SYNOPSIS,OPTIONS,DESCRIPTION,EXAMPLES", 0);
395 if (gUnicodeCollation->StriColl (gUnicodeCollation, CommandToGetHelpOn, L
"special") == 0) {
403 SortedCommandList =
NULL;
404 SortedCommandListSize = 0;
408 for (CurrentCommand = SortedCommandList
409 ; CurrentCommand !=
NULL && CurrentCommand < SortedCommandList + SortedCommandListSize/
sizeof (CHAR16) && *CurrentCommand != CHAR_NULL
410 ; CurrentCommand +=
StrLen (CurrentCommand) + 1
420 if ((gUnicodeCollation->MetaiMatch (gUnicodeCollation, (CHAR16 *)CurrentCommand, CommandToGetHelpOn)) ||
421 ((gEfiShellProtocol->GetAlias (CommandToGetHelpOn,
NULL) !=
NULL) && (gUnicodeCollation->MetaiMatch (gUnicodeCollation, (CHAR16 *)CurrentCommand, (CHAR16 *)(gEfiShellProtocol->GetAlias (CommandToGetHelpOn,
NULL))))))
426 Status =
ShellPrintHelp (CurrentCommand, SectionToGetHelpOn, PrintCommandText);
427 if (EFI_ERROR (Status)) {
434 if (Status == EFI_DEVICE_ERROR) {
436 }
else if (EFI_ERROR (Status)) {
449 if (Status == EFI_DEVICE_ERROR) {
451 }
else if (EFI_ERROR (Status)) {
470 if ((CommandToGetHelpOn !=
NULL) && (
StrCmp (CommandToGetHelpOn, L
"*") == 0)) {
478 if (CommandToGetHelpOn !=
NULL) {
482 if (SectionToGetHelpOn !=
NULL) {
486 SHELL_FREE_NON_NULL (SortedCommandList);
488 return (ShellStatus);
BOOLEAN EFIAPI IsNull(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
UINTN EFIAPI StrSize(IN CONST CHAR16 *String)
BOOLEAN EFIAPI IsListEmpty(IN CONST LIST_ENTRY *ListHead)
RETURN_STATUS EFIAPI StrCpyS(OUT CHAR16 *Destination, IN UINTN DestMax, IN CONST CHAR16 *Source)
LIST_ENTRY *EFIAPI GetNextNode(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
INTN EFIAPI StrCmp(IN CONST CHAR16 *FirstString, IN CONST CHAR16 *SecondString)
LIST_ENTRY *EFIAPI GetFirstNode(IN CONST LIST_ENTRY *List)
UINTN EFIAPI StrLen(IN CONST CHAR16 *String)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI ReallocatePool(IN UINTN OldSize, IN UINTN NewSize, IN VOID *OldBuffer OPTIONAL)
VOID EFIAPI FreePool(IN VOID *Buffer)
EFI_HANDLE *EFIAPI GetHandleListByProtocol(IN CONST EFI_GUID *ProtocolGuid OPTIONAL)
SHELL_STATUS EFIAPI ShellCommandRunHelp(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
EFI_STATUS CopyListOfCommandNames(IN OUT CHAR16 **DestList, IN OUT UINTN *DestSize, IN CONST COMMAND_LIST *SourceList)
STATIC EFI_STATUS CopyListOfCommandNamesWithDynamic(IN OUT CHAR16 **DestList, IN OUT UINTN *DestSize)
EFI_STATUS LexicalInsertIntoList(IN OUT CHAR16 **DestList, IN OUT UINTN *DestSize, IN CONST CHAR16 *Item)
EFI_STATUS PrintDynamicCommandHelp(IN CONST CHAR16 *CommandToGetHelpOn, IN CONST CHAR16 *SectionToGetHelpOn, IN BOOLEAN PrintCommandText)
#define ASSERT_EFI_ERROR(StatusParameter)
@ SHELL_INVALID_PARAMETER
EFI_STATUS EFIAPI CommandInit(VOID)
CONST COMMAND_LIST *EFIAPI ShellCommandGetCommandList(IN CONST BOOLEAN Sort)
EFI_STATUS EFIAPI ShellPrintHelp(IN CONST CHAR16 *CommandToGetHelpOn, IN CONST CHAR16 *SectionToGetHelpOn, IN BOOLEAN PrintCommandText)
CONST CHAR16 *EFIAPI ShellCommandLineGetValue(IN CONST LIST_ENTRY *CheckPackage, IN CHAR16 *KeyString)
BOOLEAN EFIAPI ShellGetExecutionBreakFlag(VOID)
#define ShellCommandLineParse(CheckList, CheckPackage, ProblemParam, AutoPageBreak)
Make it easy to upgrade from older versions of the shell library.
EFI_STATUS EFIAPI ShellPrintHiiEx(IN INT32 Col OPTIONAL, IN INT32 Row OPTIONAL, IN CONST CHAR8 *Language OPTIONAL, IN CONST EFI_STRING_ID HiiFormatStringId, IN CONST EFI_HII_HANDLE HiiFormatHandle,...)
BOOLEAN EFIAPI ShellCommandLineGetFlag(IN CONST LIST_ENTRY *CONST CheckPackage, IN CONST CHAR16 *CONST KeyString)
@ TypeMaxValue
A flag followed by all the command line data before the next flag.
@ TypeFlag
A flag that is present or not present only (IE "-a").
CHAR16 *EFIAPI StrnCatGrow(IN OUT CHAR16 **Destination, IN OUT UINTN *CurrentSize, IN CONST CHAR16 *Source, IN UINTN Count)
VOID EFIAPI ShellCommandLineFreeVarList(IN LIST_ENTRY *CheckPackage)
EFI_STATUS EFIAPI ShellInitialize(VOID)
CONST CHAR16 *EFIAPI ShellCommandLineGetRawValue(IN CONST LIST_ENTRY *CONST CheckPackage, IN UINTN Position)
EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL protocol structure.