Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16147
6f19259b-4bc3-4df7-8a09-
765794883524
/** @file\r
Main file for Alias shell level 3 function.\r
\r
/** @file\r
Main file for Alias shell level 3 function.\r
\r
- Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved. <BR>\r
+ Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved. <BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
SHELL_STATUS ShellStatus;\r
CONST CHAR16 *Param1;\r
CONST CHAR16 *Param2;\r
SHELL_STATUS ShellStatus;\r
CONST CHAR16 *Param1;\r
CONST CHAR16 *Param2;\r
\r
ProblemParam = NULL;\r
ShellStatus = SHELL_SUCCESS;\r
\r
ProblemParam = NULL;\r
ShellStatus = SHELL_SUCCESS;\r
\r
//\r
// initialize the shell lib (we must be in non-auto-init...)\r
\r
//\r
// initialize the shell lib (we must be in non-auto-init...)\r
} else {\r
Param1 = ShellCommandLineGetRawValue(Package, 1);\r
Param2 = ShellCommandLineGetRawValue(Package, 2);\r
} else {\r
Param1 = ShellCommandLineGetRawValue(Package, 1);\r
Param2 = ShellCommandLineGetRawValue(Package, 2);\r
+\r
+ if (Param2 != NULL) {\r
+ CleanParam2 = AllocateCopyPool (StrSize(Param2), Param2);\r
+ if (CleanParam2 == NULL) {\r
+ return SHELL_OUT_OF_RESOURCES;\r
+ }\r
+\r
+ if (CleanParam2[0] == L'\"' && CleanParam2[StrLen(CleanParam2)-1] == L'\"') {\r
+ CleanParam2[StrLen(CleanParam2)-1] = L'\0';\r
+ CopyMem (CleanParam2, CleanParam2 + 1, StrSize(CleanParam2) - sizeof(CleanParam2[0]));\r
+ }\r
+ }\r
+\r
//\r
// check for "-?"\r
//\r
//\r
// check for "-?"\r
//\r
//\r
// must be adding an alias\r
//\r
//\r
// must be adding an alias\r
//\r
- Status = gEfiShellProtocol->SetAlias(Param2, Param1, FALSE, ShellCommandLineGetFlag(Package, L"-v"));\r
+ Status = gEfiShellProtocol->SetAlias(CleanParam2, Param1, FALSE, ShellCommandLineGetFlag(Package, L"-v"));\r
if (EFI_ERROR(Status)) {\r
if (Status == EFI_ACCESS_DENIED) {\r
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_AD), gShellLevel3HiiHandle);\r
if (EFI_ERROR(Status)) {\r
if (Status == EFI_ACCESS_DENIED) {\r
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_AD), gShellLevel3HiiHandle);\r
ShellCommandLineFreeVarList (Package);\r
}\r
\r
ShellCommandLineFreeVarList (Package);\r
}\r
\r
+ SHELL_FREE_NON_NULL (CleanParam2);\r
return (ShellStatus);\r
}\r
return (ShellStatus);\r
}\r