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