Revision: 14202
http://edk2.svn.sourceforge.net/edk2/?rev=14202&view=rev
Author: jcarsey
Date: 2013-03-12 20:54:07 +0000 (Tue, 12 Mar 2013)
Log Message:
-----------
ShellPkg: Rewrite?\226?\128?\153s Help.c to call the ShellPrintHelp function.
also, adds a footer to the bottom of the ?\226?\128?\156help?\226?\128?\157
command to explain help switches.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Matt Stanbro <[email protected]>
Reviewed-by: Jaben Carsey <[email protected]>
Reviewed-by: Erik Bjorge <[email protected]>
Modified Paths:
--------------
trunk/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/Help.c
trunk/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.uni
Modified: trunk/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/Help.c
===================================================================
--- trunk/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/Help.c
2013-03-12 08:38:42 UTC (rev 14201)
+++ trunk/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/Help.c
2013-03-12 20:54:07 UTC (rev 14202)
@@ -1,7 +1,7 @@
/** @file
Main file for Help shell level 3 function.
- Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved. <BR>
+ Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved. <BR>
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
@@ -48,9 +48,9 @@
CHAR16 *SectionToGetHelpOn;
CHAR16 *HiiString;
BOOLEAN Found;
- BOOLEAN HelpPage;
+ BOOLEAN PrintCommandText;
- HelpPage = FALSE;
+ PrintCommandText = TRUE;
ProblemParam = NULL;
ShellStatus = SHELL_SUCCESS;
OutText = NULL;
@@ -111,7 +111,7 @@
ASSERT(SectionToGetHelpOn == NULL);
StrnCatGrow(&SectionToGetHelpOn, NULL, L"NAME", 0);
} else {
- HelpPage = TRUE;
+ PrintCommandText = FALSE;
ASSERT(SectionToGetHelpOn == NULL);
//
// Get the section name for the given command name
@@ -156,26 +156,13 @@
//
// We have a command to look for help on.
//
- Status = gEfiShellProtocol->GetHelpText(Node->CommandString,
SectionToGetHelpOn, &OutText);
- if (EFI_ERROR(Status) || OutText == NULL) {
- if (Status == EFI_DEVICE_ERROR) {
+ Status = ShellPrintHelp(Node->CommandString, SectionToGetHelpOn,
PrintCommandText);
+ if (Status == EFI_DEVICE_ERROR) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HELP_INV),
gShellLevel3HiiHandle, Node->CommandString);
- } else {
+ } else if (EFI_ERROR(Status)) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HELP_NF),
gShellLevel3HiiHandle, Node->CommandString);
- }
- ShellStatus = SHELL_NOT_FOUND;
} else {
- if (HelpPage) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN
(STR_HELP_PAGE_COMMAND), gShellLevel3HiiHandle, OutText);
- } else {
- while (OutText[StrLen(OutText)-1] == L'\r' ||
OutText[StrLen(OutText)-1] == L'\n' || OutText[StrLen(OutText)-1] == L' ') {
- OutText[StrLen(OutText)-1] = CHAR_NULL;
- }
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HELP_COMMAND),
gShellLevel3HiiHandle, Node->CommandString, OutText);
- }
- FreePool(OutText);
- OutText = NULL;
- Found = TRUE;
+ Found = TRUE;
}
}
}
@@ -183,30 +170,18 @@
// Search the .man file for Shell applications (Shell external
commands).
//
if (!Found) {
- Status = gEfiShellProtocol->GetHelpText (CommandToGetHelpOn,
SectionToGetHelpOn, &OutText);
- if (EFI_ERROR(Status) || OutText == NULL) {
+ Status = ShellPrintHelp(CommandToGetHelpOn, SectionToGetHelpOn,
FALSE);
if (Status == EFI_DEVICE_ERROR) {
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HELP_INV),
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 {
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HELP_NF),
gShellLevel3HiiHandle, CommandToGetHelpOn);
+ Found = TRUE;
}
- ShellStatus = SHELL_NOT_FOUND;
- } else {
- while (OutText[StrLen (OutText) - 1] == L'\r' || OutText[StrLen
(OutText) - 1] == L'\n' || OutText[StrLen (OutText) - 1] == L' ') {
- OutText[StrLen (OutText)-1] = CHAR_NULL;
- }
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HELP_COMMAND),
gShellLevel3HiiHandle, CommandToGetHelpOn, OutText);
- if (OutText != NULL) {
- FreePool (OutText);
- OutText = NULL;
- }
- Found = TRUE;
- }
}
}
- if (!Found && ShellStatus == SHELL_SUCCESS) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HELP_NF),
gShellLevel3HiiHandle, CommandToGetHelpOn);
+ if (!Found) {
ShellStatus = SHELL_NOT_FOUND;
}
@@ -216,6 +191,14 @@
ShellCommandLineFreeVarList (Package);
}
}
+
+ 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);
+ }
if (CommandToGetHelpOn != NULL) {
FreePool(CommandToGetHelpOn);
}
Modified:
trunk/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.uni
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits