Revision: 16147
          http://sourceforge.net/p/edk2/code/16147
Author:   shenshushi
Date:     2014-09-19 01:34:44 +0000 (Fri, 19 Sep 2014)
Log Message:
-----------
ShellPkg: Remove the redundant quotes around the parameter for 'alias'.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <[email protected]>
Reviewed-by: Jaben Carsey <[email protected]>

Modified Paths:
--------------
    trunk/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/Alias.c

Modified: trunk/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/Alias.c
===================================================================
--- trunk/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/Alias.c      
2014-09-19 01:32:05 UTC (rev 16146)
+++ trunk/edk2/ShellPkg/Library/UefiShellLevel3CommandsLib/Alias.c      
2014-09-19 01:34:44 UTC (rev 16147)
@@ -1,7 +1,7 @@
 /** @file
   Main file for Alias shell level 3 function.
 
-  Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved. <BR>
+  Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved. <BR>
   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 @@
   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 @@
   } 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 @@
       //
       // 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 @@
     ShellCommandLineFreeVarList (Package);
   }
 
+  SHELL_FREE_NON_NULL (CleanParam2);
   return (ShellStatus);
 }


------------------------------------------------------------------------------
Slashdot TV.  Video for Nerds.  Stuff that Matters.
http://pubads.g.doubleclick.net/gampad/clk?id=160591471&iu=/4140/ostg.clktrk
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to