ShellPkg: Add support for CTRL-C within shell user prompting

This allows for the user to get out of answering a question with CTRL-C

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Erik Bjorge <erik.c.bjorge@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14950 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Jaben Carsey 2013-12-09 22:55:13 +00:00 committed by jcarsey
parent 0f83ac340f
commit 194ae48dae
1 changed files with 21 additions and 0 deletions

View File

@ -3296,6 +3296,10 @@ ShellPromptForResponse (
// //
*Resp = ShellPromptResponseMax; *Resp = ShellPromptResponseMax;
while (*Resp == ShellPromptResponseMax) { while (*Resp == ShellPromptResponseMax) {
if (ShellGetExecutionBreakFlag()) {
Status = EFI_ABORTED;
break;
}
gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex); gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex);
Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key); Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
ASSERT_EFI_ERROR(Status); ASSERT_EFI_ERROR(Status);
@ -3324,6 +3328,10 @@ ShellPromptForResponse (
// //
*Resp = ShellPromptResponseMax; *Resp = ShellPromptResponseMax;
while (*Resp == ShellPromptResponseMax) { while (*Resp == ShellPromptResponseMax) {
if (ShellGetExecutionBreakFlag()) {
Status = EFI_ABORTED;
break;
}
gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex); gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex);
Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key); Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
ASSERT_EFI_ERROR(Status); ASSERT_EFI_ERROR(Status);
@ -3358,6 +3366,10 @@ ShellPromptForResponse (
// //
*Resp = ShellPromptResponseMax; *Resp = ShellPromptResponseMax;
while (*Resp == ShellPromptResponseMax) { while (*Resp == ShellPromptResponseMax) {
if (ShellGetExecutionBreakFlag()) {
Status = EFI_ABORTED;
break;
}
gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex); gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex);
if (Type == ShellPromptResponseTypeEnterContinue) { if (Type == ShellPromptResponseTypeEnterContinue) {
Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key); Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
@ -3385,6 +3397,10 @@ ShellPromptForResponse (
// //
*Resp = ShellPromptResponseMax; *Resp = ShellPromptResponseMax;
while (*Resp == ShellPromptResponseMax) { while (*Resp == ShellPromptResponseMax) {
if (ShellGetExecutionBreakFlag()) {
Status = EFI_ABORTED;
break;
}
gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex); gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex);
Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key); Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
ASSERT_EFI_ERROR(Status); ASSERT_EFI_ERROR(Status);
@ -3406,6 +3422,10 @@ ShellPromptForResponse (
ShellPrintEx(-1, -1, L"%s", Prompt); ShellPrintEx(-1, -1, L"%s", Prompt);
} }
while(1) { while(1) {
if (ShellGetExecutionBreakFlag()) {
Status = EFI_ABORTED;
break;
}
gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex); gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex);
Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key); Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
ASSERT_EFI_ERROR(Status); ASSERT_EFI_ERROR(Status);
@ -3419,6 +3439,7 @@ ShellPromptForResponse (
break; break;
// //
// This is the location to add new prompt types. // This is the location to add new prompt types.
// If your new type loops remember to add ExecutionBreak support.
// //
default: default:
ASSERT(FALSE); ASSERT(FALSE);