2 Main file for Pause shell level 3 function.
4 (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
5 Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved. <BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #include "UefiShellLevel3CommandsLib.h"
12 STATIC CONST SHELL_PARAM_ITEM ParamList
[] = {
18 Function for 'pause' command.
20 @param[in] ImageHandle Handle to the Image (NULL if Internal).
21 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
25 ShellCommandRunPause (
26 IN EFI_HANDLE ImageHandle
,
27 IN EFI_SYSTEM_TABLE
*SystemTable
33 SHELL_STATUS ShellStatus
;
34 SHELL_PROMPT_RESPONSE
*Resp
;
37 ShellStatus
= SHELL_SUCCESS
;
41 // initialize the shell lib (we must be in non-auto-init...)
43 Status
= ShellInitialize ();
44 ASSERT_EFI_ERROR (Status
);
46 Status
= CommandInit ();
47 ASSERT_EFI_ERROR (Status
);
49 if (!gEfiShellProtocol
->BatchIsActive ()) {
50 ShellPrintHiiEx (-1, -1, NULL
, STRING_TOKEN (STR_NO_SCRIPT
), gShellLevel3HiiHandle
, L
"pause");
51 return (SHELL_UNSUPPORTED
);
55 // parse the command line
57 Status
= ShellCommandLineParse (ParamList
, &Package
, &ProblemParam
, TRUE
);
58 if (EFI_ERROR (Status
)) {
59 if ((Status
== EFI_VOLUME_CORRUPTED
) && (ProblemParam
!= NULL
)) {
60 ShellPrintHiiEx (-1, -1, NULL
, STRING_TOKEN (STR_GEN_PROBLEM
), gShellLevel3HiiHandle
, L
"pause", ProblemParam
);
61 FreePool (ProblemParam
);
62 ShellStatus
= SHELL_INVALID_PARAMETER
;
70 if (ShellCommandLineGetFlag (Package
, L
"-?")) {
72 } else if (ShellCommandLineGetRawValue (Package
, 1) != NULL
) {
73 ShellPrintHiiEx (-1, -1, NULL
, STRING_TOKEN (STR_GEN_TOO_MANY
), gShellLevel3HiiHandle
, L
"pause");
74 ShellStatus
= SHELL_INVALID_PARAMETER
;
76 if (!ShellCommandLineGetFlag (Package
, L
"-q")) {
77 Status
= ShellPromptForResponseHii (ShellPromptResponseTypeQuitContinue
, STRING_TOKEN (STR_PAUSE_PROMPT
), gShellLevel3HiiHandle
, (VOID
**)&Resp
);
79 Status
= ShellPromptForResponse (ShellPromptResponseTypeQuitContinue
, NULL
, (VOID
**)&Resp
);
82 if (EFI_ERROR (Status
) || (Resp
== NULL
) || (*Resp
== ShellPromptResponseQuit
)) {
83 ShellCommandRegisterExit (TRUE
, 0);
84 ShellStatus
= SHELL_ABORTED
;
93 // free the command line package
95 ShellCommandLineFreeVarList (Package
);