Add CTRL+C support for ‘ls’ command.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Tapan Shah <tapandshah@hp.com>
Reviewed-By: Jaben Carsey <jaben.carsey@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15989 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Tapan Shah 2014-08-29 20:24:58 +00:00 committed by jcarsey
parent 9b5268c8f7
commit 8a3146d46c
1 changed files with 14 additions and 3 deletions

View File

@ -1,7 +1,7 @@
/** @file
Main file for ls shell level 2 function.
Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
Copyright (c) 2013 - 2014, Hewlett-Packard Development Company, L.P.<BR>
Copyright (c) 2009 - 2014, 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
@ -408,6 +408,10 @@ PrintLsOutput(
; !IsNull(&ListHead->Link, &Node->Link)
; Node = (EFI_SHELL_FILE_INFO *)GetNextNode(&ListHead->Link, &Node->Link)
){
if (ShellGetExecutionBreakFlag ()) {
ShellStatus = SHELL_ABORTED;
break;
}
ASSERT(Node != NULL);
if (LongestPath < StrSize(Node->FullName)) {
LongestPath = StrSize(Node->FullName);
@ -445,12 +449,12 @@ PrintLsOutput(
HeaderPrinted = TRUE;
}
if (!Sfo) {
if (!Sfo && ShellStatus != SHELL_ABORTED) {
PrintNonSfoFooter(FileCount, FileSize, DirCount);
}
}
if (Rec) {
if (Rec && ShellStatus != SHELL_ABORTED) {
//
// Re-Open all the files under the starting path for directories that didnt necessarily match our file filter
//
@ -493,6 +497,13 @@ PrintLsOutput(
&FoundOne,
Count,
TimeZone);
//
// Since it's running recursively, we have to break immediately when returned SHELL_ABORTED
//
if (ShellStatus == SHELL_ABORTED) {
break;
}
}
}
}