]> git.proxmox.com Git - mirror_edk2.git/blame - ShellPkg/Library/UefiShellLevel3CommandsLib/Pause.c
ShellPkg: Standardized HP Copyright Message String
[mirror_edk2.git] / ShellPkg / Library / UefiShellLevel3CommandsLib / Pause.c
CommitLineData
a405b86d 1/** @file\r
2 Main file for Pause shell level 3 function.\r
3\r
c011b6c9 4 (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>\r
0d807dae 5 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved. <BR>\r
a405b86d 6 This program and the accompanying materials\r
7 are licensed and made available under the terms and conditions of the BSD License\r
8 which accompanies this distribution. The full text of the license may be found at\r
9 http://opensource.org/licenses/bsd-license.php\r
10\r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
16#include "UefiShellLevel3CommandsLib.h"\r
17\r
18STATIC CONST SHELL_PARAM_ITEM ParamList[] = {\r
19 {L"-q", TypeFlag},\r
20 {NULL, TypeMax}\r
21 };\r
22\r
23/**\r
24 Function for 'pause' command.\r
25\r
26 @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
27 @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
28**/\r
29SHELL_STATUS\r
30EFIAPI\r
31ShellCommandRunPause (\r
32 IN EFI_HANDLE ImageHandle,\r
33 IN EFI_SYSTEM_TABLE *SystemTable\r
34 )\r
35{\r
36 EFI_STATUS Status;\r
37 LIST_ENTRY *Package;\r
38 CHAR16 *ProblemParam;\r
39 SHELL_STATUS ShellStatus;\r
40 SHELL_PROMPT_RESPONSE *Resp;\r
41\r
42 ProblemParam = NULL;\r
43 ShellStatus = SHELL_SUCCESS;\r
0d807dae 44 Resp = NULL;\r
a405b86d 45\r
46 //\r
47 // initialize the shell lib (we must be in non-auto-init...)\r
48 //\r
49 Status = ShellInitialize();\r
50 ASSERT_EFI_ERROR(Status);\r
51\r
52 Status = CommandInit();\r
53 ASSERT_EFI_ERROR(Status);\r
54\r
55 if (!gEfiShellProtocol->BatchIsActive()) {\r
e54a10bb 56 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_NO_SCRIPT), gShellLevel3HiiHandle, L"pause"); \r
a405b86d 57 return (SHELL_UNSUPPORTED);\r
58 }\r
59\r
60 //\r
61 // parse the command line\r
62 //\r
63 Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);\r
64 if (EFI_ERROR(Status)) {\r
65 if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {\r
e54a10bb 66 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel3HiiHandle, L"pause", ProblemParam); \r
a405b86d 67 FreePool(ProblemParam);\r
68 ShellStatus = SHELL_INVALID_PARAMETER;\r
69 } else {\r
70 ASSERT(FALSE);\r
71 }\r
72 } else {\r
73 //\r
74 // check for "-?"\r
75 //\r
76 if (ShellCommandLineGetFlag(Package, L"-?")) {\r
77 ASSERT(FALSE);\r
78 } else if (ShellCommandLineGetRawValue(Package, 1) != NULL) {\r
e54a10bb 79 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel3HiiHandle, L"pause"); \r
a405b86d 80 ShellStatus = SHELL_INVALID_PARAMETER;\r
81 } else {\r
82 if (!ShellCommandLineGetFlag(Package, L"-q")) {\r
83 Status = ShellPromptForResponseHii(ShellPromptResponseTypeQuitContinue, STRING_TOKEN (STR_PAUSE_PROMPT), gShellLevel3HiiHandle, (VOID**)&Resp);\r
84 } else {\r
85 Status = ShellPromptForResponse(ShellPromptResponseTypeQuitContinue, NULL, (VOID**)&Resp);\r
86 }\r
a405b86d 87\r
a49f6a2f 88 if (EFI_ERROR(Status) || Resp == NULL || *Resp == ShellPromptResponseQuit) {\r
b6b22b13 89 ShellCommandRegisterExit(TRUE, 0);\r
a405b86d 90 ShellStatus = SHELL_ABORTED;\r
91 }\r
92\r
93 if (Resp != NULL) {\r
94 FreePool(Resp);\r
95 }\r
96 }\r
97\r
98 //\r
99 // free the command line package\r
100 //\r
101 ShellCommandLineFreeVarList (Package);\r
102 }\r
103\r
104\r
105 return (ShellStatus);\r
106}\r
107\r