diff options
Diffstat (limited to 'ShellPkg/Library/UefiShellLevel1CommandsLib/For.c')
-rw-r--r-- | ShellPkg/Library/UefiShellLevel1CommandsLib/For.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/ShellPkg/Library/UefiShellLevel1CommandsLib/For.c b/ShellPkg/Library/UefiShellLevel1CommandsLib/For.c index 4fdbdd051d..40f6677f9b 100644 --- a/ShellPkg/Library/UefiShellLevel1CommandsLib/For.c +++ b/ShellPkg/Library/UefiShellLevel1CommandsLib/For.c @@ -294,6 +294,7 @@ ShellCommandRunFor ( SCRIPT_FILE *CurrentScriptFile;
CHAR16 *ArgSet;
CHAR16 *ArgSetWalker;
+ CHAR16 *Parameter;
UINTN ArgSize;
UINTN LoopVar;
SHELL_FOR_INFO *Info;
@@ -309,6 +310,7 @@ ShellCommandRunFor ( ShellStatus = SHELL_SUCCESS;
ArgSetWalker = NULL;
TempString = NULL;
+ Parameter = NULL;
FirstPass = FALSE;
//
@@ -391,9 +393,15 @@ ShellCommandRunFor ( ShellCloseFileMetaArg(&FileList);
}
} else {
- ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L" \"", 0);
- ArgSet = StrnCatGrow(&ArgSet, &ArgSize, gEfiShellParametersProtocol->Argv[LoopVar], 0);
- ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L"\"", 0);
+ Parameter = gEfiShellParametersProtocol->Argv[LoopVar];
+ if (Parameter[0] == L'\"' && Parameter[StrLen(Parameter)-1] == L'\"') {
+ ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L" ", 0);
+ ArgSet = StrnCatGrow(&ArgSet, &ArgSize, Parameter, 0);
+ } else {
+ ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L" \"", 0);
+ ArgSet = StrnCatGrow(&ArgSet, &ArgSize, Parameter, 0);
+ ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L"\"", 0);
+ }
}
}
if (ArgSet == NULL) {
@@ -695,12 +703,6 @@ ShellCommandRunFor ( if (Info->CurrentValue[0] == L'\"') {
Info->CurrentValue++;
}
- while (Info->CurrentValue[0] == L' ') {
- Info->CurrentValue++;
- }
- if (Info->CurrentValue[0] == L'\"') {
- Info->CurrentValue++;
- }
FreePool(TempString);
}
} else {
|