]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ShellPkg: Fix Shell fail with redundant space following delay number.
authorQiu Shumin <shumin.qiu@intel.com>
Thu, 10 Sep 2015 03:08:56 +0000 (03:08 +0000)
committershenshushi <shenshushi@Edk2>
Thu, 10 Sep 2015 03:08:56 +0000 (03:08 +0000)
When boot from Shell we can use '-delay [num]' as optional data. If blank space exist after '[num]' Shell will fail. This patch add error handling to avoid this failure.

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@18431 6f19259b-4bc3-4df7-8a09-765794883524

ShellPkg/Application/Shell/Shell.h
ShellPkg/Application/Shell/ShellParametersProtocol.c

index 4d804fc45bb3add38c2d60e960be26f677434602..b6686256aac3aa49cdebff06b54c13e078ce2446 100644 (file)
@@ -360,5 +360,16 @@ FindFirstCharacter(
   IN CONST CHAR16 EscapeCharacter\r
   );\r
 \r
+/**\r
+  Cleans off leading and trailing spaces and tabs.\r
+\r
+  @param[in] String pointer to the string to trim them off.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+TrimSpaces(\r
+  IN CHAR16 **String\r
+  );\r
+\r
 #endif //_SHELL_INTERNAL_HEADER_\r
 \r
index 1c1367bdf89c0dc2c9c4910049b2bc82e5888260..bc19df7e931e7d556a684671f5f1a8863a8ecf62 100644 (file)
@@ -359,6 +359,7 @@ CreatePopulateInstallShellParametersProtocol (
     //\r
     // Populate Argc and Argv\r
     //\r
+    TrimSpaces (&FullCommandLine);\r
     Status = ParseCommandLineToArgs(FullCommandLine,\r
                                     &(*NewShellParameters)->Argv,\r
                                     &(*NewShellParameters)->Argc);\r