VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellLevel3CommandsLib/Pause.c@ 99404

Last change on this file since 99404 was 99404, checked in by vboxsync, 2 years ago

Devices/EFI/FirmwareNew: Update to edk2-stable202302 and make it build, bugref:4643

  • Property svn:eol-style set to native
File size: 2.8 KB
Line 
1/** @file
2 Main file for Pause shell level 3 function.
3
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
7
8**/
9
10#include "UefiShellLevel3CommandsLib.h"
11
12STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
13 { L"-q", TypeFlag },
14 { NULL, TypeMax }
15};
16
17/**
18 Function for 'pause' command.
19
20 @param[in] ImageHandle Handle to the Image (NULL if Internal).
21 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
22**/
23SHELL_STATUS
24EFIAPI
25ShellCommandRunPause (
26 IN EFI_HANDLE ImageHandle,
27 IN EFI_SYSTEM_TABLE *SystemTable
28 )
29{
30 EFI_STATUS Status;
31 LIST_ENTRY *Package;
32 CHAR16 *ProblemParam;
33 SHELL_STATUS ShellStatus;
34 SHELL_PROMPT_RESPONSE *Resp;
35
36 ProblemParam = NULL;
37 ShellStatus = SHELL_SUCCESS;
38 Resp = NULL;
39
40 //
41 // initialize the shell lib (we must be in non-auto-init...)
42 //
43 Status = ShellInitialize ();
44 ASSERT_EFI_ERROR (Status);
45
46 Status = CommandInit ();
47 ASSERT_EFI_ERROR (Status);
48
49 if (!gEfiShellProtocol->BatchIsActive ()) {
50 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_NO_SCRIPT), gShellLevel3HiiHandle, L"pause");
51 return (SHELL_UNSUPPORTED);
52 }
53
54 //
55 // parse the command line
56 //
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;
63 } else {
64 ASSERT (FALSE);
65 }
66 } else {
67 //
68 // check for "-?"
69 //
70 if (ShellCommandLineGetFlag (Package, L"-?")) {
71 ASSERT (FALSE);
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;
75 } else {
76 if (!ShellCommandLineGetFlag (Package, L"-q")) {
77 Status = ShellPromptForResponseHii (ShellPromptResponseTypeQuitContinue, STRING_TOKEN (STR_PAUSE_PROMPT), gShellLevel3HiiHandle, (VOID **)&Resp);
78 } else {
79 Status = ShellPromptForResponse (ShellPromptResponseTypeQuitContinue, NULL, (VOID **)&Resp);
80 }
81
82 if (EFI_ERROR (Status) || (Resp == NULL) || (*Resp == ShellPromptResponseQuit)) {
83 ShellCommandRegisterExit (TRUE, 0);
84 ShellStatus = SHELL_ABORTED;
85 }
86
87 if (Resp != NULL) {
88 FreePool (Resp);
89 }
90 }
91
92 //
93 // free the command line package
94 //
95 ShellCommandLineFreeVarList (Package);
96 }
97
98 return (ShellStatus);
99}
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette