]>
Commit | Line | Data |
---|---|---|
a405b86d | 1 | /** @file\r |
2 | Main file for NULL named library for level 3 shell command functions.\r | |
3 | \r | |
c011b6c9 | 4 | (C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>\r |
345cd235 | 5 | Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved. <BR>\r |
56ba3746 | 6 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
a405b86d | 7 | \r |
8 | **/\r | |
9 | #include "UefiShellLevel3CommandsLib.h"\r | |
10 | \r | |
47d20b54 MK |
11 | CONST CHAR16 gShellLevel3FileName[] = L"ShellCommands";\r |
12 | EFI_HII_HANDLE gShellLevel3HiiHandle = NULL;\r | |
a405b86d | 13 | \r |
345cd235 | 14 | /**\r |
15 | return the filename to get help from is not using HII.\r | |
16 | \r | |
17 | @retval The filename.\r | |
18 | **/\r | |
47d20b54 | 19 | CONST CHAR16 *\r |
a405b86d | 20 | EFIAPI\r |
21 | ShellCommandGetManFileNameLevel3 (\r | |
22 | VOID\r | |
23 | )\r | |
24 | {\r | |
25 | return (gShellLevel3FileName);\r | |
26 | }\r | |
27 | \r | |
28 | /**\r | |
29 | Constructor for the Shell Level 3 Commands library.\r | |
30 | \r | |
31 | Install the handlers for level 3 UEFI Shell 2.0 commands.\r | |
32 | \r | |
33 | @param ImageHandle the image handle of the process\r | |
34 | @param SystemTable the EFI System Table pointer\r | |
35 | \r | |
36 | @retval EFI_SUCCESS the shell command handlers were installed sucessfully\r | |
37 | @retval EFI_UNSUPPORTED the shell level required was not found.\r | |
38 | **/\r | |
39 | EFI_STATUS\r | |
40 | EFIAPI\r | |
41 | ShellLevel3CommandsLibConstructor (\r | |
42 | IN EFI_HANDLE ImageHandle,\r | |
43 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
44 | )\r | |
45 | {\r | |
46 | gShellLevel3HiiHandle = NULL;\r | |
47 | //\r | |
48 | // if shell level is less than 3 do nothing\r | |
49 | //\r | |
47d20b54 | 50 | if (PcdGet8 (PcdShellSupportLevel) < 3) {\r |
82571fb5 | 51 | return (EFI_SUCCESS);\r |
a405b86d | 52 | }\r |
53 | \r | |
54 | gShellLevel3HiiHandle = HiiAddPackages (&gShellLevel3HiiGuid, gImageHandle, UefiShellLevel3CommandsLibStrings, NULL);\r | |
55 | if (gShellLevel3HiiHandle == NULL) {\r | |
56 | return (EFI_DEVICE_ERROR);\r | |
57 | }\r | |
47d20b54 | 58 | \r |
a405b86d | 59 | //\r |
60 | // install our shell command handlers that are always installed\r | |
61 | //\r | |
62 | // Note: that Time, Timezone, and Date are part of level 2 library\r | |
63 | //\r | |
47d20b54 MK |
64 | ShellCommandRegisterCommandName (L"type", ShellCommandRunType, ShellCommandGetManFileNameLevel3, 3, L"", TRUE, gShellLevel3HiiHandle, STRING_TOKEN (STR_GET_HELP_TYPE));\r |
65 | ShellCommandRegisterCommandName (L"touch", ShellCommandRunTouch, ShellCommandGetManFileNameLevel3, 3, L"", TRUE, gShellLevel3HiiHandle, STRING_TOKEN (STR_GET_HELP_TOUCH));\r | |
66 | ShellCommandRegisterCommandName (L"ver", ShellCommandRunVer, ShellCommandGetManFileNameLevel3, 3, L"", TRUE, gShellLevel3HiiHandle, STRING_TOKEN (STR_GET_HELP_VER));\r | |
67 | ShellCommandRegisterCommandName (L"alias", ShellCommandRunAlias, ShellCommandGetManFileNameLevel3, 3, L"", TRUE, gShellLevel3HiiHandle, STRING_TOKEN (STR_GET_HELP_ALIAS));\r | |
68 | ShellCommandRegisterCommandName (L"cls", ShellCommandRunCls, ShellCommandGetManFileNameLevel3, 3, L"", TRUE, gShellLevel3HiiHandle, STRING_TOKEN (STR_GET_HELP_CLS));\r | |
69 | ShellCommandRegisterCommandName (L"echo", ShellCommandRunEcho, ShellCommandGetManFileNameLevel3, 3, L"", FALSE, gShellLevel3HiiHandle, STRING_TOKEN (STR_GET_HELP_ECHO));\r | |
70 | ShellCommandRegisterCommandName (L"pause", ShellCommandRunPause, ShellCommandGetManFileNameLevel3, 3, L"", TRUE, gShellLevel3HiiHandle, STRING_TOKEN (STR_GET_HELP_PAUSE));\r | |
71 | ShellCommandRegisterCommandName (L"getmtc", ShellCommandRunGetMtc, ShellCommandGetManFileNameLevel3, 3, L"", TRUE, gShellLevel3HiiHandle, STRING_TOKEN (STR_GET_HELP_GETMTC));\r | |
72 | ShellCommandRegisterCommandName (L"help", ShellCommandRunHelp, ShellCommandGetManFileNameLevel3, 3, L"", TRUE, gShellLevel3HiiHandle, STRING_TOKEN (STR_GET_HELP_HELP));\r | |
73 | \r | |
74 | ShellCommandRegisterAlias (L"type", L"cat");\r | |
6cef9b9f | 75 | \r |
a405b86d | 76 | return (EFI_SUCCESS);\r |
77 | }\r | |
78 | \r | |
79 | /**\r | |
80 | Destructor for the library. free any resources.\r | |
345cd235 | 81 | \r |
82 | @param ImageHandle The image handle of the process.\r | |
83 | @param SystemTable The EFI System Table pointer.\r | |
a405b86d | 84 | **/\r |
85 | EFI_STATUS\r | |
86 | EFIAPI\r | |
87 | ShellLevel3CommandsLibDestructor (\r | |
88 | IN EFI_HANDLE ImageHandle,\r | |
89 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
90 | )\r | |
91 | {\r | |
92 | if (gShellLevel3HiiHandle != NULL) {\r | |
47d20b54 | 93 | HiiRemovePackages (gShellLevel3HiiHandle);\r |
a405b86d | 94 | }\r |
47d20b54 | 95 | \r |
a405b86d | 96 | return (EFI_SUCCESS);\r |
97 | }\r |