From 0faec4cf5256beff7b2e9cd4431a32f200515872 Mon Sep 17 00:00:00 2001 From: Qiu Shumin Date: Fri, 19 Sep 2014 01:34:44 +0000 Subject: ShellPkg: Remove the redundant quotes around the parameter for 'alias'. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Qiu Shumin Reviewed-by: Jaben Carsey git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16147 6f19259b-4bc3-4df7-8a09-765794883524 --- ShellPkg/Library/UefiShellLevel3CommandsLib/Alias.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'ShellPkg') diff --git a/ShellPkg/Library/UefiShellLevel3CommandsLib/Alias.c b/ShellPkg/Library/UefiShellLevel3CommandsLib/Alias.c index 1428d37a64..550296f82c 100644 --- a/ShellPkg/Library/UefiShellLevel3CommandsLib/Alias.c +++ b/ShellPkg/Library/UefiShellLevel3CommandsLib/Alias.c @@ -1,7 +1,7 @@ /** @file Main file for Alias shell level 3 function. - Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 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 which accompanies this distribution. The full text of the license may be found at @@ -90,9 +90,11 @@ ShellCommandRunAlias ( SHELL_STATUS ShellStatus; CONST CHAR16 *Param1; CONST CHAR16 *Param2; + CHAR16 *CleanParam2; ProblemParam = NULL; ShellStatus = SHELL_SUCCESS; + CleanParam2 = NULL; // // initialize the shell lib (we must be in non-auto-init...) @@ -118,6 +120,19 @@ ShellCommandRunAlias ( } else { Param1 = ShellCommandLineGetRawValue(Package, 1); Param2 = ShellCommandLineGetRawValue(Package, 2); + + if (Param2 != NULL) { + CleanParam2 = AllocateCopyPool (StrSize(Param2), Param2); + if (CleanParam2 == NULL) { + return SHELL_OUT_OF_RESOURCES; + } + + if (CleanParam2[0] == L'\"' && CleanParam2[StrLen(CleanParam2)-1] == L'\"') { + CleanParam2[StrLen(CleanParam2)-1] = L'\0'; + CopyMem (CleanParam2, CleanParam2 + 1, StrSize(CleanParam2) - sizeof(CleanParam2[0])); + } + } + // // check for "-?" // @@ -138,7 +153,7 @@ ShellCommandRunAlias ( // // must be adding an alias // - Status = gEfiShellProtocol->SetAlias(Param2, Param1, FALSE, ShellCommandLineGetFlag(Package, L"-v")); + Status = gEfiShellProtocol->SetAlias(CleanParam2, Param1, FALSE, ShellCommandLineGetFlag(Package, L"-v")); if (EFI_ERROR(Status)) { if (Status == EFI_ACCESS_DENIED) { ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_AD), gShellLevel3HiiHandle); @@ -161,5 +176,6 @@ ShellCommandRunAlias ( ShellCommandLineFreeVarList (Package); } + SHELL_FREE_NON_NULL (CleanParam2); return (ShellStatus); } -- cgit v1.2.3