summaryrefslogtreecommitdiff
path: root/ShellPkg/Library/UefiShellLevel2CommandsLib
diff options
context:
space:
mode:
authorTapan Shah <tapandshah@hp.com>2014-08-29 20:24:58 +0000
committerjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>2014-08-29 20:24:58 +0000
commit8a3146d46cea07829a0948f0848db04784541cea (patch)
treee4f78c857fb5b9efb418f926675418b08012a78b /ShellPkg/Library/UefiShellLevel2CommandsLib
parent9b5268c8f7223422de1ad5b278355586f088cdde (diff)
downloadedk2-platforms-8a3146d46cea07829a0948f0848db04784541cea.tar.xz
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
Diffstat (limited to 'ShellPkg/Library/UefiShellLevel2CommandsLib')
-rw-r--r--ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c
index 64ce4ae2c0..523096ac22 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) 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;
+ }
}
}
}