diff options
author | Qiu Shumin <shumin.qiu@intel.com> | 2014-09-17 07:52:35 +0000 |
---|---|---|
committer | shenshushi <shenshushi@6f19259b-4bc3-4df7-8a09-765794883524> | 2014-09-17 07:52:35 +0000 |
commit | 3a3395f06b95ad5a0a78e23d293929e6809e09e5 (patch) | |
tree | 2723fbae6365d4eec3dc1da547a3c498c7aa5b1b /ShellPkg | |
parent | 926be9d10cab8f841af5d5b619eb11e8a7a19af9 (diff) | |
download | edk2-platforms-3a3395f06b95ad5a0a78e23d293929e6809e09e5.tar.xz |
ShellPkg: Remove redundant quotes for command 'FOR' in Shell.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16121 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ShellPkg')
-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 {
|