ShellPkg: Check for Abort flag in main 'for' loop of ls command and propagate the condition when found.

Also prevents printing of an error output when user selects abort.

signed-off-by: jcarsey
reviewed-by: 

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12925 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jcarsey 2012-01-11 18:45:23 +00:00
parent fa449c61c4
commit a7224eefeb
1 changed files with 12 additions and 3 deletions

View File

@ -1,7 +1,7 @@
/** @file
Main file for ls shell level 2 function.
Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
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
@ -354,9 +354,14 @@ PrintLsOutput(
ShellStatus = SHELL_OUT_OF_RESOURCES;
} else {
for ( Node = (EFI_SHELL_FILE_INFO *)GetFirstNode(&ListHead->Link)
; !IsNull(&ListHead->Link, &Node->Link)
; !IsNull(&ListHead->Link, &Node->Link) && ShellStatus == SHELL_SUCCESS
; Node = (EFI_SHELL_FILE_INFO *)GetNextNode(&ListHead->Link, &Node->Link)
){
if (ShellGetExecutionBreakFlag ()) {
ShellStatus = SHELL_ABORTED;
break;
}
//
// recurse on any directory except the traversing ones...
//
@ -366,7 +371,7 @@ PrintLsOutput(
){
StrCpy(DirectoryName, Node->FullName);
StrCat(DirectoryName, L"\\*");
PrintLsOutput(
ShellStatus = PrintLsOutput(
Rec,
Attribs,
Sfo,
@ -558,6 +563,10 @@ ShellCommandRunLs (
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_FILES), gShellLevel2HiiHandle);
} else if (ShellStatus == SHELL_INVALID_PARAMETER) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel2HiiHandle);
} else if (ShellStatus == SHELL_ABORTED) {
//
// Ignore aborting.
//
} else if (ShellStatus != SHELL_SUCCESS) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel2HiiHandle);
}