X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=EmbeddedPkg%2FEbl%2FCommand.c;h=78ddcd19367e20a57e2310a914fc981424ceb846;hp=3efe6ee671e6e6e1376055d374eb9c59b165024e;hb=7ca9e5a4010b0e16231173dfc1918685ffc3a1dd;hpb=a6d7123ebc57243b405fa12cf5a6e2da9eb73895 diff --git a/EmbeddedPkg/Ebl/Command.c b/EmbeddedPkg/Ebl/Command.c index 3efe6ee671..78ddcd1936 100644 --- a/EmbeddedPkg/Ebl/Command.c +++ b/EmbeddedPkg/Ebl/Command.c @@ -1,10 +1,10 @@ /** @file Basic commands and command processing infrastructure for EBL - Copyright (c) 2007, Intel Corporation
- Portions copyright (c) 2008-2009, Apple Inc. All rights reserved. + Copyright (c) 2007, Intel Corporation. All rights reserved.
+ Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
- All rights reserved. This program and the accompanying materials + This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php @@ -46,7 +46,7 @@ AsciiToUpper ( /** - Case insensitve comparison of two Null-terminated Unicode strings with maximum + Case insensitive comparison of two Null-terminated Unicode strings with maximum lengths, and returns the difference between the first mismatched Unicode characters. This function compares the Null-terminated Unicode string FirstString to the @@ -94,9 +94,9 @@ AsciiStrniCmp ( /** Add a command to the mCmdTable. If there is no free space in the command table ASSERT. The mCmdTable is maintained in alphabetical order and the - new entry is inserted into its sorted possition. + new entry is inserted into its sorted position. - @param Entry Commnad Entry to add to the CmdTable + @param Entry Command Entry to add to the CmdTable **/ VOID @@ -139,7 +139,7 @@ EblAddCommand ( array of commands. @param EntryArray Pointer to array of command entries - @param ArrayCount Number of commnad entries to add + @param ArrayCount Number of command entries to add **/ VOID @@ -168,8 +168,8 @@ EBL_ADD_COMMAND_PROTOCOL gEblAddCommand = { /** Return the best matching command for the passed in command name. The match - does not have to be exact, it just needs to be unqiue. This enables commands - to be shortend to the smallest set of starting characters that is unique. + does not have to be exact, it just needs to be unique. This enables commands + to be shortened to the smallest set of starting characters that is unique. @param CommandName Name of command to search for @@ -220,6 +220,26 @@ EblGetCommand ( } +UINTN +CountNewLines ( + IN CHAR8 *Str + ) +{ + UINTN Count; + + if (Str == NULL) { + return 0; + } + + for (Count = 0; *Str != '\0'; Str++) { + if (Str[Count] == '\n') { + Count++; + } + } + + return Count; +} + /** List out help information on all the commands or print extended information @@ -230,7 +250,7 @@ EblGetCommand ( @param Argc Number of command arguments in Argv @param Argv Array of strings that represent the parsed command line. - Argv[0] is the comamnd name + Argv[0] is the command name @return EFI_SUCCESS @@ -243,16 +263,22 @@ EblHelpCmd ( { UINTN Index; CHAR8 *Ptr; - UINTN CurrentRow; + UINTN CurrentRow = 0; if (Argc == 1) { // Print all the commands AsciiPrint ("Embedded Boot Loader (EBL) commands (help command for more info):\n"); + CurrentRow++; for (Index = 0; Index < mCmdTableNextFreeIndex; Index++) { EblSetTextColor (EFI_YELLOW); AsciiPrint (" %a", mCmdTable[Index]->Name); EblSetTextColor (0); AsciiPrint ("%a\n", mCmdTable[Index]->HelpSummary); + // Handle multi line help summaries + CurrentRow += CountNewLines (mCmdTable[Index]->HelpSummary); + if (EblAnyKeyToContinueQtoQuit (&CurrentRow, FALSE)) { + break; + } } } else if (Argv[1] != NULL) { // Print specific help @@ -260,6 +286,8 @@ EblHelpCmd ( if (AsciiStriCmp (Argv[1], mCmdTable[Index]->Name) == 0) { Ptr = (mCmdTable[Index]->Help == NULL) ? mCmdTable[Index]->HelpSummary : mCmdTable[Index]->Help; AsciiPrint ("%a%a\n", Argv[1], Ptr); + // Handle multi line help summaries + CurrentRow += CountNewLines (Ptr); if (EblAnyKeyToContinueQtoQuit (&CurrentRow, FALSE)) { break; } @@ -272,14 +300,14 @@ EblHelpCmd ( /** - Exit the EBL. If the commnad processor sees EFI_ABORTED return status it will + Exit the EBL. If the command processor sees EFI_ABORTED return status it will exit the EBL. Argv[0] - "exit" @param Argc Number of command arguments in Argv @param Argv Array of strings that represent the parsed command line. - Argv[0] is the comamnd name + Argv[0] is the command name @return EFI_ABORTED @@ -360,7 +388,7 @@ EblExitCmd ( This AsciiPrint has to match the AsciiPrint in EblPauseCmd. - @param ElaspedTime Current timout value remaining + @param ElaspedTime Current timeout value remaining **/ VOID @@ -383,10 +411,10 @@ EblPauseCallback ( @param Argc Number of command arguments in Argv @param Argv Array of strings that represent the parsed command line. - Argv[0] is the comamnd name + Argv[0] is the command name @return EFI_SUCCESS Timeout expired with no input - @return EFI_TIMEOUT Stop procesing other commands on the same command line + @return EFI_TIMEOUT Stop processing other commands on the same command line **/ EFI_STATUS @@ -405,8 +433,8 @@ EblPauseCmd ( Status = EblGetCharKey (&Key, Delay, EblPauseCallback); AsciiPrint ("\n"); - // If we timeout then the pause succeded thus return success - // If we get a key return timout to stop other commnad on this cmd line + // If we timeout then the pause succeeded thus return success + // If we get a key return timeout to stop other command on this cmd line return (Status == EFI_SUCCESS) ? EFI_TIMEOUT : EFI_SUCCESS;; } @@ -418,7 +446,7 @@ EblPauseCmd ( @param Argc Number of command arguments in Argv @param Argv Array of strings that represent the parsed command line. - Argv[0] is the comamnd name + Argv[0] is the command name @return EFI_SUCCESS @@ -444,7 +472,7 @@ EblBreakPointCmd ( @param Argc Number of command arguments in Argv @param Argv Array of strings that represent the parsed command line. - Argv[0] is the comamnd name + Argv[0] is the command name @return EFI_SUCCESS @@ -484,7 +512,7 @@ EblResetCmd ( @param Argc Number of command arguments in Argv @param Argv Array of strings that represent the parsed command line. - Argv[0] is the comamnd name + Argv[0] is the command name @return EFI_SUCCESS @@ -665,7 +693,7 @@ OutputData ( Example hexdump.4 returns a width of 4. - @param Argv Argv[0] is the comamnd name + @param Argv Argv[0] is the command name @return Width of command @@ -707,7 +735,7 @@ WidthFromCommandName ( @param Argc Number of command arguments in Argv @param Argv Array of strings that represent the parsed command line. - Argv[0] is the comamnd name + Argv[0] is the command name @return EFI_SUCCESS @@ -847,7 +875,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED const EBL_COMMAND_TABLE mCmdTemplate[] = }, { "hexdump", - "[.{1|2|4}] filename [Offset] [Size]; dump a file as hex bytes at a given width", + "[.{1|2|4}] filename [Offset] [Size]; dump a file as hex .width", NULL, EblHexdumpCmd }