From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=qTf6NvgI; spf=pass (domain: arm.com, ip: 40.107.7.84, mailfrom: krzysztof.koch@arm.com) Received: from EUR04-HE1-obe.outbound.protection.outlook.com (EUR04-HE1-obe.outbound.protection.outlook.com [40.107.7.84]) by groups.io with SMTP; Fri, 28 Jun 2019 01:59:24 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=36M7Iju9N5bKFhNoamWPNfN+qxzUe7LuP5jO3qUyhZs=; b=qTf6NvgIoIjc8yF1nP3jRgdJjNqdkuPFkaIdmNIlXiw78scnu+B1g/h1U+WWD2O3qQzdgDVhaH1lIxEL+i1MH56uPYfFqmcqBVBFeGdCgU4YOtMoecbfzxWhEPVS2DitdJ7iFxCwDQOiXFJU4C2yok2/O5uhTB5vj+VkFBpS1CU= Received: from HE1PR08CA0073.eurprd08.prod.outlook.com (2603:10a6:7:2a::44) by DB8PR08MB5033.eurprd08.prod.outlook.com (2603:10a6:10:e7::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2032.17; Fri, 28 Jun 2019 08:59:20 +0000 Received: from VE1EUR03FT055.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e09::204) by HE1PR08CA0073.outlook.office365.com (2603:10a6:7:2a::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2008.16 via Frontend Transport; Fri, 28 Jun 2019 08:59:20 +0000 Authentication-Results: spf=temperror (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=temperror action=none header.from=arm.com; Received-SPF: TempError (protection.outlook.com: error in processing during lookup of arm.com: DNS Timeout) Received: from nebula.arm.com (40.67.248.234) by VE1EUR03FT055.mail.protection.outlook.com (10.152.19.158) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2032.15 via Frontend Transport; Fri, 28 Jun 2019 08:59:18 +0000 Received: from AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1415.2; Fri, 28 Jun 2019 08:57:12 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1415.2; Fri, 28 Jun 2019 08:57:12 +0000 Received: from E119924.Arm.com (10.1.199.124) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.1415.2 via Frontend Transport; Fri, 28 Jun 2019 08:57:12 +0000 From: "Krzysztof Koch" To: CC: , , , , , Subject: [PATCH v1 5/5] ShellPkg: acpiview: Make '-h' option not require a parameter Date: Fri, 28 Jun 2019 09:57:00 +0100 Message-ID: <20190628085700.17472-6-krzysztof.koch@arm.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: <20190628085700.17472-1-krzysztof.koch@arm.com> References: <20190628085700.17472-1-krzysztof.koch@arm.com> Return-Path: Krzysztof.Koch@arm.com MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:40.67.248.234;IPV:NLI;CTRY:IE;EFV:NLI;SFV:NSPM;SFS:(10009020)(4636009)(376002)(39860400002)(396003)(346002)(136003)(2980300002)(199004)(189003)(81156014)(966005)(50466002)(486006)(305945005)(6916009)(356004)(6666004)(70586007)(2906002)(5660300002)(72206003)(70206006)(86362001)(48376002)(36756003)(1076003)(446003)(54906003)(50226002)(476003)(126002)(11346002)(186003)(478600001)(16586007)(77096007)(26005)(316002)(47776003)(8676002)(7696005)(76176011)(53416004)(2351001)(68736007)(44832011)(53936002)(8936002)(4326008)(51416003)(6306002)(426003)(63350400001)(63370400001)(2616005)(336012)(81166006);DIR:OUT;SFP:1101;SCL:1;SRVR:DB8PR08MB5033;H:nebula.arm.com;FPR:;SPF:TempError;LANG:en;PTR:InfoDomainNonexistent;A:1;MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d7acfbf8-8807-488f-a07f-08d6fba6e76b X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328);SRVR:DB8PR08MB5033; X-MS-TrafficTypeDiagnostic: DB8PR08MB5033: X-MS-Exchange-PUrlCount: 1 X-Microsoft-Antispam-PRVS: NoDisclaimer: True X-MS-Oob-TLC-OOBClassifiers: OLM:31; X-Forefront-PRVS: 00826B6158 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: pZrLrN9Aa8wgzv14r6xWjqqiwMv2bg9lz/m3Xpd1+VXbBTx1Lry2Yd0exJ4aBQq2i0I5gEfmkHFAVcFXe6zs4bDV5ymQHMeMEkFV4FLQLTjG51MZtrHFdyUHcPryBJHIoyKsyLK3A2OAdppoAPzKH0Ynx5yL3Nl/o6F3wjKl7v36TrtJPTjko3juaIPvYLTUJUQVdJcxZj/lUMbzvY4jO635DY9aseqK3PW2+lgaePrfdpOkJs7LXBRju6fqRWtZL6khCUNPc6nkt0+zFYHZ1a8SwmsoGFbgWSNZvUkAvxibkULP9S2aG1pf5IT44ADXXHCfoEUx8kvuYHEmSdccOKlXea+Ojcut3x/l6P84HlXsRwO0ax+Xy+RP52n3qpIuOyMdDfpY74k+hBkx62bpoSCErYl0aB97xcd+IZx7lcg= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jun 2019 08:59:18.3675 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d7acfbf8-8807-488f-a07f-08d6fba6e76b X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[40.67.248.234];Helo=[nebula.arm.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB5033 Content-Type: text/plain 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 --- Changes can be seen at: https://github.com/KrzysztofKoch1/edk2/commit/c3e78ab9d47f51e4c6a786a8813d1fa01685f0c9 Notes: v1: - turn the '-h' acpiview input option into a flag [Krzysztof] ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c | 30 ++------------------ ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.uni | 6 ++-- 2 files changed, 5 insertions(+), 31 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c index 911b2da3dd9f19010d0f4993bcf017749cafb749..9feb2df2078f5aff41e1d39081fbb8cbc0bc32dd 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")); diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.uni b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.uni index 0d10b5debe470cb096cf414d0a0144fd3bde03ee..1f07b7ae20d474be67a433ff3774a508a5289318 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.uni +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.uni @@ -30,7 +30,7 @@ "Display ACPI Table information.\r\n" ".SH SYNOPSIS\r\n" " \r\n" -"ACPIVIEW [[-?] | [[-l] | [-s AcpiTable [-d]]] [-q] [-h Highlight]]\r\n" +"ACPIVIEW [[-?] | [[-l] | [-s AcpiTable [-d]]] [-q] [-h]]\r\n" " \r\n" ".SH OPTIONS\r\n" " \r\n" @@ -40,9 +40,7 @@ " AcpiTable : The required ACPI Table type.\r\n" " -d - Generate a binary file dump of the specified AcpiTable.\r\n" " -q - Quiet. Suppress errors and warnings. Disables consistency checks.\r\n" -" -h - Enable/Disable Colour Highlighting.\r\n" -" Highlight : TRUE/ON enables highlighting;\r\n" -" FALSE/OFF (default) disables highlighting.\r\n" +" -h - Enable colour highlighting.\r\n" " -? - Show help.\r\n" " \r\n" ".SH DESCRIPTION\r\n" -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'