summaryrefslogtreecommitdiff
path: root/ShellPkg
diff options
context:
space:
mode:
authorLeandro G. Biss Becker <lbecker@positivo.com.br>2014-02-05 21:16:47 +0000
committerjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>2014-02-05 21:16:47 +0000
commit5b05611330bf23450a688bf1899de9525d82b654 (patch)
tree982288ac0bfc7f2ee81288e89b7e75c36f76d29b /ShellPkg
parent3f3659e2f70055c073566910149eb08019ceb6c2 (diff)
downloadedk2-platforms-5b05611330bf23450a688bf1899de9525d82b654.tar.xz
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
Diffstat (limited to 'ShellPkg')
-rw-r--r--ShellPkg/Library/UefiShellLevel1CommandsLib/For.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/ShellPkg/Library/UefiShellLevel1CommandsLib/For.c b/ShellPkg/Library/UefiShellLevel1CommandsLib/For.c
index 46182f7141..85b85d8dcf 100644
--- a/ShellPkg/Library/UefiShellLevel1CommandsLib/For.c
+++ b/ShellPkg/Library/UefiShellLevel1CommandsLib/For.c
@@ -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, L" \"", 0);
ArgSet = StrnCatGrow(&ArgSet, &ArgSize, gEfiShellParametersProtocol->Argv[LoopVar], 0);
+ ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L"\"", 0);
}
- ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L"\"", 0);
}
if (ArgSet == NULL) {
ShellStatus = SHELL_OUT_OF_RESOURCES;