]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ShellPkg: Remove the redundant quotes around the parameter for 'alias'.
authorQiu Shumin <shumin.qiu@intel.com>
Fri, 19 Sep 2014 01:34:44 +0000 (01:34 +0000)
committershenshushi <shenshushi@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 19 Sep 2014 01:34:44 +0000 (01:34 +0000)
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

ShellPkg/Library/UefiShellLevel3CommandsLib/Alias.c

index 1428d37a64065dfc8a3108828c3b0845a736d46d..550296f82cdfa16ab2c670103cec54a880041788 100644 (file)
@@ -1,7 +1,7 @@
 /** @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
@@ -90,9 +90,11 @@ ShellCommandRunAlias (
   SHELL_STATUS        ShellStatus;\r
   CONST CHAR16        *Param1;\r
   CONST CHAR16        *Param2;\r
+  CHAR16              *CleanParam2;\r
 \r
   ProblemParam        = NULL;\r
   ShellStatus         = SHELL_SUCCESS;\r
+  CleanParam2         = NULL;\r
 \r
   //\r
   // initialize the shell lib (we must be in non-auto-init...)\r
@@ -118,6 +120,19 @@ ShellCommandRunAlias (
   } 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
@@ -138,7 +153,7 @@ ShellCommandRunAlias (
       //\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
@@ -161,5 +176,6 @@ ShellCommandRunAlias (
     ShellCommandLineFreeVarList (Package);\r
   }\r
 \r
+  SHELL_FREE_NON_NULL (CleanParam2);\r
   return (ShellStatus);\r
 }\r