NetworkPkg: Support print help information using -? command.

v2:
*Modify the logic of show SAD,SPD and PAD help info, include them in -?
instead of follow -p command.

Since Shell supports finding help information from resource section
of application image. We modify the Shell application Under NetworkPkg
to support print help information string using -? command.

Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
This commit is contained in:
Zhang, Lubo
2016-02-29 14:25:50 +08:00
committed by Jiaxin Wu
parent fa848a4048
commit be6cd654eb
15 changed files with 325 additions and 214 deletions

View File

@@ -1,7 +1,7 @@
/** @file
The implementation for Ping6 application.
Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2009 - 2016, 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
@@ -19,6 +19,7 @@
#include <Library/MemoryAllocationLib.h>
#include <Library/DebugLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiHiiServicesLib.h>
#include <Library/HiiLib.h>
#include <Library/NetLib.h>
@@ -42,10 +43,6 @@ SHELL_PARAM_ITEM Ping6ParamList[] = {
L"-s",
TypeValue
},
{
L"-?",
TypeFlag
},
{
NULL,
TypeMax
@@ -1059,11 +1056,36 @@ InitializePing6 (
CONST CHAR16 *ValueStr;
CONST CHAR16 *ValueStrPtr;
UINTN NonOptionCount;
EFI_HII_PACKAGE_LIST_HEADER *PackageList;
//
// Register our string package with HII and return the handle to it.
// Retrieve HII package list from ImageHandle
//
mHiiHandle = HiiAddPackages (&gEfiCallerIdGuid, ImageHandle, Ping6Strings, NULL);
Status = gBS->OpenProtocol (
ImageHandle,
&gEfiHiiPackageListProtocolGuid,
(VOID **) &PackageList,
ImageHandle,
NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (EFI_ERROR (Status)) {
return Status;
}
//
// Publish HII package list to HII Database.
//
Status = gHiiDatabase->NewPackageList (
gHiiDatabase,
PackageList,
NULL,
&mHiiHandle
);
if (EFI_ERROR (Status)) {
return Status;
}
ASSERT (mHiiHandle != NULL);
Status = ShellCommandLineParseEx (Ping6ParamList, &ParamPackage, NULL, TRUE, FALSE);
@@ -1072,11 +1094,6 @@ InitializePing6 (
goto ON_EXIT;
}
if (ShellCommandLineGetFlag (ParamPackage, L"-?")) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING6_HELP), mHiiHandle);
goto ON_EXIT;
}
SendNumber = 10;
BufferSize = 16;