2 Main file for Pause shell level 3 function.
4 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved. <BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #include "UefiShellLevel3CommandsLib.h"
17 STATIC CONST SHELL_PARAM_ITEM ParamList
[] = {
23 Function for 'pause' command.
25 @param[in] ImageHandle Handle to the Image (NULL if Internal).
26 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
30 ShellCommandRunPause (
31 IN EFI_HANDLE ImageHandle
,
32 IN EFI_SYSTEM_TABLE
*SystemTable
38 SHELL_STATUS ShellStatus
;
39 SHELL_PROMPT_RESPONSE
*Resp
;
42 ShellStatus
= SHELL_SUCCESS
;
46 // initialize the shell lib (we must be in non-auto-init...)
48 Status
= ShellInitialize();
49 ASSERT_EFI_ERROR(Status
);
51 Status
= CommandInit();
52 ASSERT_EFI_ERROR(Status
);
54 if (!gEfiShellProtocol
->BatchIsActive()) {
55 ShellPrintHiiEx(-1, -1, NULL
, STRING_TOKEN (STR_GEN_SCRIPT_ONLY
), gShellLevel3HiiHandle
);
56 return (SHELL_UNSUPPORTED
);
60 // parse the command line
62 Status
= ShellCommandLineParse (ParamList
, &Package
, &ProblemParam
, TRUE
);
63 if (EFI_ERROR(Status
)) {
64 if (Status
== EFI_VOLUME_CORRUPTED
&& ProblemParam
!= NULL
) {
65 ShellPrintHiiEx(-1, -1, NULL
, STRING_TOKEN (STR_GEN_PROBLEM
), gShellLevel3HiiHandle
, ProblemParam
);
66 FreePool(ProblemParam
);
67 ShellStatus
= SHELL_INVALID_PARAMETER
;
75 if (ShellCommandLineGetFlag(Package
, L
"-?")) {
77 } else if (ShellCommandLineGetRawValue(Package
, 1) != NULL
) {
78 ShellPrintHiiEx(-1, -1, NULL
, STRING_TOKEN (STR_GEN_TOO_MANY
), gShellLevel3HiiHandle
);
79 ShellStatus
= SHELL_INVALID_PARAMETER
;
81 if (!ShellCommandLineGetFlag(Package
, L
"-q")) {
82 Status
= ShellPromptForResponseHii(ShellPromptResponseTypeQuitContinue
, STRING_TOKEN (STR_PAUSE_PROMPT
), gShellLevel3HiiHandle
, (VOID
**)&Resp
);
84 Status
= ShellPromptForResponse(ShellPromptResponseTypeQuitContinue
, NULL
, (VOID
**)&Resp
);
87 if (EFI_ERROR(Status
) || Resp
== NULL
|| *Resp
== ShellPromptResponseQuit
) {
88 ShellCommandRegisterExit(TRUE
, 0);
89 ShellStatus
= SHELL_ABORTED
;
98 // free the command line package
100 ShellCommandLineFreeVarList (Package
);
104 return (ShellStatus
);