summaryrefslogtreecommitdiffstats
path: root/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
diff options
context:
space:
mode:
authorKrzysztof Koch <krzysztof.koch@arm.com>2019-06-28 16:57:00 +0800
committerRay Ni <ray.ni@intel.com>2019-07-02 17:22:46 +0800
commit4286eb22f4aec33b90574b998a31f8bd34dd4f47 (patch)
tree61aa895cb7335052ecee3a0c178f105508917489 /ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
parent5ed3b5624f91b2738a90598ea8a9c085cfab851e (diff)
downloadedk2-4286eb22f4aec33b90574b998a31f8bd34dd4f47.tar.gz
edk2-4286eb22f4aec33b90574b998a31f8bd34dd4f47.tar.bz2
edk2-4286eb22f4aec33b90574b998a31f8bd34dd4f47.zip
ShellPkg: acpiview: Make '-h' option not require a parameter
Make the -h command line option a binary flag. Now, colour highlighting is enabled whenever this flag is set (stateless), instead of being dependent on previous acpiview command invocations. By removing the parameter required with the -h flag the command line parsing logic becomes simpler. Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Diffstat (limited to 'ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c')
-rw-r--r--ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c30
1 files changed, 3 insertions, 27 deletions
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
index 911b2da3dd..9feb2df207 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
@@ -34,7 +34,7 @@ STATIC BOOLEAN mColourHighlighting;
STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
{L"-q", TypeFlag},
{L"-d", TypeFlag},
- {L"-h", TypeValue},
+ {L"-h", TypeFlag},
{L"-l", TypeFlag},
{L"-s", TypeValue},
{NULL, TypeMax}
@@ -459,8 +459,6 @@ ShellCommandRunAcpiView (
SHELL_STATUS ShellStatus;
LIST_ENTRY* Package;
CHAR16* ProblemParam;
- CONST CHAR16* Temp;
- CHAR8 ColourOption[8];
SHELL_FILE_HANDLE TmpDumpFileHandle;
// Set Defaults
@@ -540,18 +538,6 @@ ShellCommandRunAcpiView (
L"acpiview"
);
ShellStatus = SHELL_INVALID_PARAMETER;
- } else if (ShellCommandLineGetFlag (Package, L"-h") &&
- ShellCommandLineGetValue (Package, L"-h") == NULL) {
- ShellPrintHiiEx (
- -1,
- -1,
- NULL,
- STRING_TOKEN (STR_GEN_NO_VALUE),
- gShellAcpiViewHiiHandle,
- L"acpiview",
- L"-h"
- );
- ShellStatus = SHELL_INVALID_PARAMETER;
} else if (ShellCommandLineGetFlag (Package, L"-d") &&
!ShellCommandLineGetFlag (Package, L"-s")) {
ShellPrintHiiEx (
@@ -566,18 +552,8 @@ ShellCommandRunAcpiView (
);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- // Check if the colour option is set
- Temp = ShellCommandLineGetValue (Package, L"-h");
- if (Temp != NULL) {
- UnicodeStrToAsciiStrS (Temp, ColourOption, sizeof (ColourOption));
- if ((AsciiStriCmp (ColourOption, "ON") == 0) ||
- (AsciiStriCmp (ColourOption, "TRUE") == 0)) {
- SetColourHighlighting (TRUE);
- } else if ((AsciiStriCmp (ColourOption, "OFF") == 0) ||
- (AsciiStriCmp (ColourOption, "FALSE") == 0)) {
- SetColourHighlighting (FALSE);
- }
- }
+ // Turn on colour highlighting if requested
+ SetColourHighlighting (ShellCommandLineGetFlag (Package, L"-h"));
// Surpress consistency checking if requested
SetConsistencyChecking (!ShellCommandLineGetFlag (Package, L"-q"));