diff options
author | jcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-01-11 18:45:23 +0000 |
---|---|---|
committer | jcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-01-11 18:45:23 +0000 |
commit | a7224eefeb3b7e51b82ecfd174553b91d6c2340e (patch) | |
tree | 67c3a97c4235e097e00be94d9869e5c37c68d08a /ShellPkg/Library | |
parent | fa449c61c44d95889fecb50c2f5808aaf10de87d (diff) | |
download | edk2-platforms-a7224eefeb3b7e51b82ecfd174553b91d6c2340e.tar.xz |
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
Diffstat (limited to 'ShellPkg/Library')
-rw-r--r-- | ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c index a93b54c429..3799341425 100644 --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c @@ -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);
}
|