2 Main file for Pause shell level 3 function.
4 (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
5 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved. <BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #include "UefiShellLevel3CommandsLib.h"
18 STATIC CONST SHELL_PARAM_ITEM ParamList
[] = {
24 Function for 'pause' command.
26 @param[in] ImageHandle Handle to the Image (NULL if Internal).
27 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
31 ShellCommandRunPause (
32 IN EFI_HANDLE ImageHandle
,
33 IN EFI_SYSTEM_TABLE
*SystemTable
39 SHELL_STATUS ShellStatus
;
40 SHELL_PROMPT_RESPONSE
*Resp
;
43 ShellStatus
= SHELL_SUCCESS
;
47 // initialize the shell lib (we must be in non-auto-init...)
49 Status
= ShellInitialize();
50 ASSERT_EFI_ERROR(Status
);
52 Status
= CommandInit();
53 ASSERT_EFI_ERROR(Status
);
55 if (!gEfiShellProtocol
->BatchIsActive()) {
56 ShellPrintHiiEx(-1, -1, NULL
, STRING_TOKEN (STR_NO_SCRIPT
), gShellLevel3HiiHandle
, L
"pause");
57 return (SHELL_UNSUPPORTED
);
61 // parse the command line
63 Status
= ShellCommandLineParse (ParamList
, &Package
, &ProblemParam
, TRUE
);
64 if (EFI_ERROR(Status
)) {
65 if (Status
== EFI_VOLUME_CORRUPTED
&& ProblemParam
!= NULL
) {
66 ShellPrintHiiEx(-1, -1, NULL
, STRING_TOKEN (STR_GEN_PROBLEM
), gShellLevel3HiiHandle
, L
"pause", ProblemParam
);
67 FreePool(ProblemParam
);
68 ShellStatus
= SHELL_INVALID_PARAMETER
;
76 if (ShellCommandLineGetFlag(Package
, L
"-?")) {
78 } else if (ShellCommandLineGetRawValue(Package
, 1) != NULL
) {
79 ShellPrintHiiEx(-1, -1, NULL
, STRING_TOKEN (STR_GEN_TOO_MANY
), gShellLevel3HiiHandle
, L
"pause");
80 ShellStatus
= SHELL_INVALID_PARAMETER
;
82 if (!ShellCommandLineGetFlag(Package
, L
"-q")) {
83 Status
= ShellPromptForResponseHii(ShellPromptResponseTypeQuitContinue
, STRING_TOKEN (STR_PAUSE_PROMPT
), gShellLevel3HiiHandle
, (VOID
**)&Resp
);
85 Status
= ShellPromptForResponse(ShellPromptResponseTypeQuitContinue
, NULL
, (VOID
**)&Resp
);
88 if (EFI_ERROR(Status
) || Resp
== NULL
|| *Resp
== ShellPromptResponseQuit
) {
89 ShellCommandRegisterExit(TRUE
, 0);
90 ShellStatus
= SHELL_ABORTED
;
99 // free the command line package
101 ShellCommandLineFreeVarList (Package
);
105 return (ShellStatus
);