diff options
author | Qiu Shumin <shumin.qiu@intel.com> | 2014-09-18 01:21:01 +0000 |
---|---|---|
committer | shenshushi <shenshushi@6f19259b-4bc3-4df7-8a09-765794883524> | 2014-09-18 01:21:01 +0000 |
commit | 4b6b543e77f3237c63e691f35d0bb259ddc287b4 (patch) | |
tree | 75542b14fa185a4267468863aca52c32f22b7de4 /ShellPkg/Application/Shell/Shell.c | |
parent | 9d66ee4d177307ca59f08d242e592ec95a325d26 (diff) | |
download | edk2-platforms-4b6b543e77f3237c63e691f35d0bb259ddc287b4.tar.xz |
ShellPkg: Fix the support for command line comments.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Chris Phillips <chrisp@hp.com>
Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16126 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ShellPkg/Application/Shell/Shell.c')
-rw-r--r-- | ShellPkg/Application/Shell/Shell.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/ShellPkg/Application/Shell/Shell.c b/ShellPkg/Application/Shell/Shell.c index 627fab0ad0..29c65b7f27 100644 --- a/ShellPkg/Application/Shell/Shell.c +++ b/ShellPkg/Application/Shell/Shell.c @@ -2139,11 +2139,24 @@ RunInternalCommand( CHAR16 **Argv;
SHELL_STATUS CommandReturnedStatus;
BOOLEAN LastError;
+ CHAR16 *Walker;
+ CHAR16 *NewCmdLine;
+
+ NewCmdLine = AllocateCopyPool (StrSize (CmdLine), CmdLine);
+ if (NewCmdLine == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ for (Walker = NewCmdLine; Walker != NULL && *Walker != CHAR_NULL ; Walker++) {
+ if (*Walker == L'^' && *(Walker+1) == L'#') {
+ CopyMem(Walker, Walker+1, StrSize(Walker) - sizeof(Walker[0]));
+ }
+ }
//
// get the argc and argv updated for internal commands
//
- Status = UpdateArgcArgv(ParamProtocol, CmdLine, &Argv, &Argc);
+ Status = UpdateArgcArgv(ParamProtocol, NewCmdLine, &Argv, &Argc);
if (!EFI_ERROR(Status)) {
//
// Run the internal command.
@@ -2204,6 +2217,7 @@ RunInternalCommand( Status = EFI_SUCCESS;
}
+ FreePool (NewCmdLine);
return (Status);
}
@@ -2466,7 +2480,7 @@ RunCommand( for (TempWalker = CleanOriginal; TempWalker != NULL && *TempWalker != CHAR_NULL; TempWalker++) {
if (*TempWalker == L'^') {
if (*(TempWalker + 1) == L'#') {
- CopyMem (TempWalker, TempWalker + 1, StrSize (TempWalker) - sizeof (TempWalker[0]));
+ TempWalker++;
}
} else if (*TempWalker == L'#') {
*TempWalker = CHAR_NULL;
@@ -2710,8 +2724,10 @@ RunScriptFileHandle ( //
for (CommandLine3 = CommandLine2 ; CommandLine3 != NULL && *CommandLine3 != CHAR_NULL ; CommandLine3++) {
if (*CommandLine3 == L'^') {
- if (*(CommandLine3+1) == L'#' || *(CommandLine3+1) == L':') {
+ if ( *(CommandLine3+1) == L':') {
CopyMem(CommandLine3, CommandLine3+1, StrSize(CommandLine3) - sizeof(CommandLine3[0]));
+ } else if (*(CommandLine3+1) == L'#') {
+ CommandLine3++;
}
} else if (*CommandLine3 == L'#') {
*CommandLine3 = CHAR_NULL;
|