From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from g4t3426.houston.hpe.com (g4t3426.houston.hpe.com [15.241.140.75]) (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 2B5FD1A1F56 for ; Thu, 22 Sep 2016 09:14:11 -0700 (PDT) Received: from SHAHTA6.americas.hpqcorp.net (shahta6.americas.hpqcorp.net [16.100.127.81]) by g4t3426.houston.hpe.com (Postfix) with ESMTP id 5153963; Thu, 22 Sep 2016 16:14:10 +0000 (UTC) From: Tapan Shah To: edk2-devel@lists.01.org Cc: jaben.carsey@intel.com, Tapan Shah Date: Thu, 22 Sep 2016 11:13:57 -0500 Message-Id: <1474560837-10660-1-git-send-email-tapandshah@hpe.com> X-Mailer: git-send-email 1.9.5.msysgit.0 Subject: [PATCH] ShellPkg: Expand special output file to include "NULL" and case insensitive 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: Thu, 22 Sep 2016 16:14:11 -0000 As per ECR 1349 change in UEFI Shell Specification 2.2, expanding a special output file name to include "NULL". Previously it only supported "NUL" as a special output file and it was case sensitive. With this change both "NUL" and "NULL" are special output file and checked as case insensitive. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Tapan Shah --- ShellPkg/Application/Shell/ShellParametersProtocol.c | 3 ++- ShellPkg/Application/Shell/ShellProtocol.c | 6 ++++-- ShellPkg/Library/UefiShellLib/UefiShellLib.c | 5 ++++- ShellPkg/Library/UefiShellLib/UefiShellLib.h | 2 ++ 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ShellPkg/Application/Shell/ShellParametersProtocol.c b/ShellPkg/Application/Shell/ShellParametersProtocol.c index 3684f9c..58156a2 100644 --- a/ShellPkg/Application/Shell/ShellParametersProtocol.c +++ b/ShellPkg/Application/Shell/ShellParametersProtocol.c @@ -2,6 +2,7 @@ Member functions of EFI_SHELL_PARAMETERS_PROTOCOL and functions for creation, manipulation, and initialization of EFI_SHELL_PARAMETERS_PROTOCOL. + (C) Copyright 2016 Hewlett Packard Enterprise Development LP
Copyright (C) 2014, Red Hat, Inc. (C) Copyright 2013 Hewlett-Packard Development Company, L.P.
Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
@@ -1174,7 +1175,7 @@ UpdateStdInStdOutStdErr( if (TempHandle == NULL) { Status = EFI_INVALID_PARAMETER; } else { - if (StrStr(StdOutFileName, L"NUL")==StdOutFileName) { + if (gUnicodeCollation->MetaiMatch (gUnicodeCollation, StdOutFileName, L"NUL")) { //no-op } else if (!OutAppend && OutUnicode && !EFI_ERROR(Status)) { Status = WriteFileTag (TempHandle); diff --git a/ShellPkg/Application/Shell/ShellProtocol.c b/ShellPkg/Application/Shell/ShellProtocol.c index 6f29250..fb7dd84 100644 --- a/ShellPkg/Application/Shell/ShellProtocol.c +++ b/ShellPkg/Application/Shell/ShellProtocol.c @@ -3,6 +3,7 @@ manipulation, and initialization of EFI_SHELL_PROTOCOL. (C) Copyright 2014 Hewlett-Packard Development Company, L.P.
+ (C) Copyright 2016 Hewlett Packard Enterprise Development LP
Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -1287,9 +1288,10 @@ EfiShellOpenFileByName( } // - // Is this for NUL file + // Is this for NUL / NULL file // - if (StrCmp(FileName, L"NUL") == 0) { + if ((gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16*)FileName, L"NUL") == 0) || + (gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16*)FileName, L"NULL") == 0)) { *FileHandle = &FileInterfaceNulFile; return (EFI_SUCCESS); } diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c b/ShellPkg/Library/UefiShellLib/UefiShellLib.c index 3dcdba6..27523e2 100644 --- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c +++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c @@ -1,6 +1,7 @@ /** @file Provides interface to shell functionality for shell commands and applications. + (C) Copyright 2016 Hewlett Packard Enterprise Development LP
Copyright 2016 Dell Inc. Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
This program and the accompanying materials @@ -720,7 +721,9 @@ ShellOpenFileByName( Status = gEfiShellProtocol->OpenFileByName(FileName, FileHandle, OpenMode); - if (StrCmp(FileName, L"NUL") != 0 && !EFI_ERROR(Status) && ((OpenMode & EFI_FILE_MODE_CREATE) != 0)){ + if ((gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16*)FileName, L"NUL") != 0) && + (gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16*)FileName, L"NULL") != 0) && + !EFI_ERROR(Status) && ((OpenMode & EFI_FILE_MODE_CREATE) != 0)){ FileInfo = FileFunctionMap.GetFileInfo(*FileHandle); ASSERT(FileInfo != NULL); FileInfo->Attribute = Attributes; diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.h b/ShellPkg/Library/UefiShellLib/UefiShellLib.h index 3596f7b..6903227 100644 --- a/ShellPkg/Library/UefiShellLib/UefiShellLib.h +++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.h @@ -1,6 +1,7 @@ /** @file Provides interface to shell functionality for shell commands and applications. + (C) Copyright 2016 Hewlett Packard Enterprise Development LP
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -38,6 +39,7 @@ #include #include #include +#include typedef struct { EFI_SHELL_GET_FILE_INFO GetFileInfo; -- 1.9.5.msysgit.0