From a7224eefeb3b7e51b82ecfd174553b91d6c2340e Mon Sep 17 00:00:00 2001 From: jcarsey Date: Wed, 11 Jan 2012 18:45:23 +0000 Subject: 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 --- ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c') 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.
+ Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.
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); } -- cgit v1.2.3