Hello,
I made a small 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.
The patch is attached in this e-mail.
I also have some modifications on the set command (set -p) to prompt
the user the value to be assigned to the variable. I don't know if those
kind of modifications are of the interest of the EDKII project. If yes,
let me know and I can release it in a patch also.
Att,
Leandro Becker
Positivo Informatica S/A
--- For.c 2014-01-28 15:53:47.140309700 -0200
+++ ForOk.c 2014-01-28 13:48:05.665584300 -0200
@@ -2,6 +2,7 @@
Main file for endfor and for shell level 1 functions.
Copyright (c) 2009 - 2012, 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
@@ -370,7 +371,6 @@
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 +378,9 @@
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 +393,10 @@
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;
@@ -700,6 +703,7 @@
while (TempString[StrLen(TempString)-1] == L'\"') {
TempString[StrLen(TempString)-1] = CHAR_NULL;
}
+
InternalUpdateAliasOnList(Info->ReplacementName, TempString,
&CurrentScriptFile->SubstList);
Info->CurrentValue += StrLen(TempString);
------------------------------------------------------------------------------
WatchGuard Dimension instantly turns raw network data into actionable
security intelligence. It gives you real-time visual feedback on key
security issues and trends. Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel