From c81863953f2aca16b2347e7e9977a06fcd1f13aa Mon Sep 17 00:00:00 2001 From: Jaben Carsey Date: Tue, 17 Dec 2013 21:40:41 +0000 Subject: [PATCH] ShellPkg: Fix "for" command statement initialization. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The shell was failing to correctly parse up to the space only for “run (1 3)” and also losing the space for “in ” a b” c” for loop initialization. This fixes for initialization to be correct. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jaben Carsey Reviewed-by: Erik Bjorge git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14997 6f19259b-4bc3-4df7-8a09-765794883524 --- ShellPkg/Library/UefiShellLevel1CommandsLib/For.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/ShellPkg/Library/UefiShellLevel1CommandsLib/For.c b/ShellPkg/Library/UefiShellLevel1CommandsLib/For.c index f0c4a23b24..46182f7141 100644 --- a/ShellPkg/Library/UefiShellLevel1CommandsLib/For.c +++ b/ShellPkg/Library/UefiShellLevel1CommandsLib/For.c @@ -270,7 +270,7 @@ ReturnUintn( { UINT64 RetVal; - if (!EFI_ERROR(ShellConvertStringToUint64(String, &RetVal, FALSE, FALSE))) { + if (!EFI_ERROR(ShellConvertStringToUint64(String, &RetVal, FALSE, TRUE))) { return ((UINTN)RetVal); } return ((UINTN)(-1)); @@ -370,11 +370,7 @@ ShellCommandRunFor ( gEfiShellParametersProtocol->Argv[2]) == 0) { for (LoopVar = 0x3 ; LoopVar < gEfiShellParametersProtocol->Argc ; LoopVar++) { ASSERT((ArgSet == NULL && ArgSize == 0) || (ArgSet != NULL)); - if (ArgSet == NULL) { - // ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L"\"", 0); - } else { - ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L" \"", 0); - } + ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L" \"", 0); if (StrStr(gEfiShellParametersProtocol->Argv[LoopVar], L"*") != NULL ||StrStr(gEfiShellParametersProtocol->Argv[LoopVar], L"?") != NULL ||StrStr(gEfiShellParametersProtocol->Argv[LoopVar], L"[") != NULL -- 2.39.2