]> git.proxmox.com Git - mirror_edk2.git/blob - ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.c
change the en-dash to the standard dash character.
[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 - 2010, 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 STATIC CONST EFI_GUID gShellLevel3HiiGuid = \
19 { \
20 0x4344558d, 0x4ef9, 0x4725, { 0xb1, 0xe4, 0x33, 0x76, 0xe8, 0xd6, 0x97, 0x4f } \
21 };
22
23 CONST CHAR16*
24 EFIAPI
25 ShellCommandGetManFileNameLevel3 (
26 VOID
27 )
28 {
29 return (gShellLevel3FileName);
30 }
31
32 /**
33 Constructor for the Shell Level 3 Commands library.
34
35 Install the handlers for level 3 UEFI Shell 2.0 commands.
36
37 @param ImageHandle the image handle of the process
38 @param SystemTable the EFI System Table pointer
39
40 @retval EFI_SUCCESS the shell command handlers were installed sucessfully
41 @retval EFI_UNSUPPORTED the shell level required was not found.
42 **/
43 EFI_STATUS
44 EFIAPI
45 ShellLevel3CommandsLibConstructor (
46 IN EFI_HANDLE ImageHandle,
47 IN EFI_SYSTEM_TABLE *SystemTable
48 )
49 {
50 gShellLevel3HiiHandle = NULL;
51 //
52 // if shell level is less than 3 do nothing
53 //
54 if (PcdGet8(PcdShellSupportLevel) < 3) {
55 return (EFI_UNSUPPORTED);
56 }
57
58 gShellLevel3HiiHandle = HiiAddPackages (&gShellLevel3HiiGuid, gImageHandle, UefiShellLevel3CommandsLibStrings, NULL);
59 if (gShellLevel3HiiHandle == NULL) {
60 return (EFI_DEVICE_ERROR);
61 }
62 //
63 // install our shell command handlers that are always installed
64 //
65 // Note: that Time, Timezone, and Date are part of level 2 library
66 //
67 ShellCommandRegisterCommandName(L"type", ShellCommandRunType , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_TYPE));
68 ShellCommandRegisterCommandName(L"touch", ShellCommandRunTouch , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_TOUCH));
69 ShellCommandRegisterCommandName(L"ver", ShellCommandRunVer , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_VER));
70 ShellCommandRegisterCommandName(L"alias", ShellCommandRunAlias , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_ALIAS));
71 ShellCommandRegisterCommandName(L"cls", ShellCommandRunCls , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_CLS));
72 ShellCommandRegisterCommandName(L"echo", ShellCommandRunEcho , ShellCommandGetManFileNameLevel3, 3, L"", FALSE, gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_ECHO));
73 ShellCommandRegisterCommandName(L"pause", ShellCommandRunPause , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_PAUSE));
74 ShellCommandRegisterCommandName(L"getmtc", ShellCommandRunGetMtc , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_GETMTC));
75 ShellCommandRegisterCommandName(L"help", ShellCommandRunHelp , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_HELP));
76
77 return (EFI_SUCCESS);
78 }
79
80 /**
81 Destructor for the library. free any resources.
82 **/
83 EFI_STATUS
84 EFIAPI
85 ShellLevel3CommandsLibDestructor (
86 IN EFI_HANDLE ImageHandle,
87 IN EFI_SYSTEM_TABLE *SystemTable
88 )
89 {
90 if (gShellLevel3HiiHandle != NULL) {
91 HiiRemovePackages(gShellLevel3HiiHandle);
92 }
93 return (EFI_SUCCESS);
94 }