From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from g2t2352.austin.hpe.com (g2t2352.austin.hpe.com [15.233.44.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 83D061A1E29 for ; Mon, 24 Oct 2016 09:56:41 -0700 (PDT) Received: from SHAHTA6.americas.hpqcorp.net (unknown [16.100.127.81]) by g2t2352.austin.hpe.com (Postfix) with ESMTP id A24FA46; Mon, 24 Oct 2016 16:56:40 +0000 (UTC) From: Tapan Shah To: edk2-devel@lists.01.org Cc: jaben.carsey@intel.com, Tapan Shah Date: Mon, 24 Oct 2016 11:56:37 -0500 Message-Id: <1477328197-1608-1-git-send-email-tapandshah@hpe.com> X-Mailer: git-send-email 1.9.5.msysgit.0 Subject: [PATCH] ShellPkg: handle '-t or -terse' and '-s' flags for 'ver' command properly X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Oct 2016 16:56:41 -0000 '-t or -terse' and '-s' flags are multiple exclusive So when both flags are used together, command should report an error message. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Tapan Shah --- ShellPkg/Library/UefiShellLevel3CommandsLib/Ver.c | 24 ++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/ShellPkg/Library/UefiShellLevel3CommandsLib/Ver.c b/ShellPkg/Library/UefiShellLevel3CommandsLib/Ver.c index deefaf0..d0e2b5c 100644 --- a/ShellPkg/Library/UefiShellLevel3CommandsLib/Ver.c +++ b/ShellPkg/Library/UefiShellLevel3CommandsLib/Ver.c @@ -1,6 +1,7 @@ /** @file Main file for Ver shell level 3 function. + (C) Copyright 2016 Hewlett Packard Enterprise Development LP
(C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.
Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.
This program and the accompanying materials @@ -84,15 +85,20 @@ ShellCommandRunVer ( ShellStatus = SHELL_INVALID_PARAMETER; } else { if (ShellCommandLineGetFlag(Package, L"-s")) { - ShellPrintHiiEx ( - 0, - gST->ConOut->Mode->CursorRow, - NULL, - STRING_TOKEN (STR_VER_OUTPUT_SIMPLE), - gShellLevel3HiiHandle, - gEfiShellProtocol->MajorVersion, - gEfiShellProtocol->MinorVersion - ); + if (ShellCommandLineGetFlag(Package, L"-terse") || ShellCommandLineGetFlag(Package, L"-t")){ + ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellLevel3HiiHandle, L"ver", L"-t or -terse", L"-s"); + ShellStatus = SHELL_INVALID_PARAMETER; + } else { + ShellPrintHiiEx ( + 0, + gST->ConOut->Mode->CursorRow, + NULL, + STRING_TOKEN (STR_VER_OUTPUT_SIMPLE), + gShellLevel3HiiHandle, + gEfiShellProtocol->MajorVersion, + gEfiShellProtocol->MinorVersion + ); + } } else { ShellPrintHiiEx ( 0, -- 1.9.5.msysgit.0