ShellPkg: patch to the "for" command when used with "in" iterating files in a folder. (for %x in *.txt). The result values (%x) have misplaced quotation marks and some spaces.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Leandro G. Biss Becker <lbecker@positivo.com.br>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15212 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Leandro G. Biss Becker 2014-02-05 21:16:47 +00:00 committed by jcarsey
parent 3f3659e2f7
commit 5b05611330
1 changed files with 4 additions and 2 deletions

View File

@ -370,7 +370,6 @@ ShellCommandRunFor (
gEfiShellParametersProtocol->Argv[2]) == 0) {
for (LoopVar = 0x3 ; LoopVar < gEfiShellParametersProtocol->Argc ; LoopVar++) {
ASSERT((ArgSet == NULL && ArgSize == 0) || (ArgSet != NULL));
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
@ -378,7 +377,9 @@ ShellCommandRunFor (
FileList = NULL;
Status = ShellOpenFileMetaArg ((CHAR16*)gEfiShellParametersProtocol->Argv[LoopVar], EFI_FILE_MODE_READ, &FileList);
if (EFI_ERROR(Status) || FileList == NULL || IsListEmpty(&FileList->Link)) {
ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L" \"", 0);
ArgSet = StrnCatGrow(&ArgSet, &ArgSize, gEfiShellParametersProtocol->Argv[LoopVar], 0);
ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L"\"", 0);
} else {
for (Node = (EFI_SHELL_FILE_INFO *)GetFirstNode(&FileList->Link)
; !IsNull(&FileList->Link, &Node->Link)
@ -391,9 +392,10 @@ ShellCommandRunFor (
ShellCloseFileMetaArg(&FileList);
}
} else {
ArgSet = StrnCatGrow(&ArgSet, &ArgSize, gEfiShellParametersProtocol->Argv[LoopVar], 0);
}
ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L" \"", 0);
ArgSet = StrnCatGrow(&ArgSet, &ArgSize, gEfiShellParametersProtocol->Argv[LoopVar], 0);
ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L"\"", 0);
}
}
if (ArgSet == NULL) {
ShellStatus = SHELL_OUT_OF_RESOURCES;