2 Main file for NULL named library for level 2 shell command functions.
5 attrib, cd, cp, date*, time*, rm, reset,
6 load, ls, map, mkdir, mv, parse, set, timezone*
9 * functions are non-interactive only
12 Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
13 This program and the accompanying materials
14 are licensed and made available under the terms and conditions of the BSD License
15 which accompanies this distribution. The full text of the license may be found at
16 http://opensource.org/licenses/bsd-license.php
18 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
19 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
24 #include <ShellBase.h>
26 #include <Protocol/EfiShell.h>
27 #include <Protocol/EfiShellParameters.h>
28 #include <Protocol/DevicePath.h>
29 #include <Protocol/LoadedImage.h>
30 #include <Protocol/UnicodeCollation.h>
31 #include <Protocol/DevicePathToText.h>
33 #include <Library/BaseLib.h>
34 #include <Library/BaseMemoryLib.h>
35 #include <Library/DebugLib.h>
36 #include <Library/MemoryAllocationLib.h>
37 #include <Library/PcdLib.h>
38 #include <Library/ShellCommandLib.h>
39 #include <Library/ShellLib.h>
40 #include <Library/UefiLib.h>
41 #include <Library/UefiRuntimeServicesTableLib.h>
42 #include <Library/UefiBootServicesTableLib.h>
43 #include <Library/HiiLib.h>
44 #include <Library/SortLib.h>
45 #include <Library/FileHandleLib.h>
47 extern CONST CHAR16 mFileName
[];
48 extern EFI_HANDLE gShellLevel2HiiHandle
;
49 extern CONST EFI_GUID gShellLevel2HiiGuid
;
52 Function for 'attrib' command.
54 @param[in] ImageHandle Handle to the Image (NULL if Internal).
55 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
59 ShellCommandRunAttrib (
60 IN EFI_HANDLE ImageHandle
,
61 IN EFI_SYSTEM_TABLE
*SystemTable
65 Function for 'date' command.
67 @param[in] ImageHandle Handle to the Image (NULL if Internal).
68 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
73 IN EFI_HANDLE ImageHandle
,
74 IN EFI_SYSTEM_TABLE
*SystemTable
78 Function for 'time' command.
80 @param[in] ImageHandle Handle to the Image (NULL if Internal).
81 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
86 IN EFI_HANDLE ImageHandle
,
87 IN EFI_SYSTEM_TABLE
*SystemTable
91 Function for 'load' command.
93 @param[in] ImageHandle Handle to the Image (NULL if Internal).
94 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
99 IN EFI_HANDLE ImageHandle
,
100 IN EFI_SYSTEM_TABLE
*SystemTable
104 Function for 'ls' command.
106 @param[in] ImageHandle Handle to the Image (NULL if Internal).
107 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
112 IN EFI_HANDLE ImageHandle
,
113 IN EFI_SYSTEM_TABLE
*SystemTable
117 Function for 'map' command.
119 @param[in] ImageHandle Handle to the Image (NULL if Internal).
120 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
125 IN EFI_HANDLE ImageHandle
,
126 IN EFI_SYSTEM_TABLE
*SystemTable
130 Function for 'reset' command.
132 @param[in] ImageHandle Handle to the Image (NULL if Internal).
133 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
137 ShellCommandRunReset (
138 IN EFI_HANDLE ImageHandle
,
139 IN EFI_SYSTEM_TABLE
*SystemTable
143 Function for 'timezone' command.
145 @param[in] ImageHandle Handle to the Image (NULL if Internal).
146 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
150 ShellCommandRunTimeZone (
151 IN EFI_HANDLE ImageHandle
,
152 IN EFI_SYSTEM_TABLE
*SystemTable
156 Function for 'set' command.
158 @param[in] ImageHandle Handle to the Image (NULL if Internal).
159 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
164 IN EFI_HANDLE ImageHandle
,
165 IN EFI_SYSTEM_TABLE
*SystemTable
169 Function for 'mkdir' command.
171 @param[in] ImageHandle Handle to the Image (NULL if Internal).
172 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
176 ShellCommandRunMkDir (
177 IN EFI_HANDLE ImageHandle
,
178 IN EFI_SYSTEM_TABLE
*SystemTable
182 Function for 'cd' command.
184 @param[in] ImageHandle Handle to the Image (NULL if Internal).
185 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
190 IN EFI_HANDLE ImageHandle
,
191 IN EFI_SYSTEM_TABLE
*SystemTable
195 Function for 'cp' command.
197 @param[in] ImageHandle Handle to the Image (NULL if Internal).
198 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
203 IN EFI_HANDLE ImageHandle
,
204 IN EFI_SYSTEM_TABLE
*SystemTable
208 Function for 'parse' command.
210 @param[in] ImageHandle Handle to the Image (NULL if Internal).
211 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
215 ShellCommandRunParse (
216 IN EFI_HANDLE ImageHandle
,
217 IN EFI_SYSTEM_TABLE
*SystemTable
221 Function for 'rm' command.
223 @param[in] ImageHandle Handle to the Image (NULL if Internal).
224 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
229 IN EFI_HANDLE ImageHandle
,
230 IN EFI_SYSTEM_TABLE
*SystemTable
234 Function for 'mv' command.
236 @param[in] ImageHandle Handle to the Image (NULL if Internal).
237 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
242 IN EFI_HANDLE ImageHandle
,
243 IN EFI_SYSTEM_TABLE
*SystemTable
247 returns a fully qualified directory (contains a map drive at the begining)
248 path from a unknown directory path.
250 If Path is already fully qualified this will return a duplicat otherwise this
251 will use get the current directory and use that to build the fully qualified
254 if the return value is not NULL it must be caller freed.
256 @param[in] Path The unknown Path Value
258 @retval NULL A memory allocation failed
259 @retval NULL a fully qualified path could not be discovered.
260 @retval other pointer to a fuly qualified path.
264 GetFullyQualifiedPath(
265 IN CONST CHAR16
* Path
269 Function to verify all intermediate directories in the path.
271 @param[in] Path The pointer to the path to fix.
273 @retval EFI_SUCCESS The operation was successful.
277 VerifyIntermediateDirectories (
278 IN CONST CHAR16
*Path
282 CaseInsensitive length limited string comparison.
284 @param[in] Source Pointer to first string.
285 @param[in] Target Pointer to second string.
286 @param[in] Count Number of characters to compare.
288 @retval 0 The strings are the same.
289 @return non-zero if the strings are different.
294 IN CONST CHAR16
*Source
,
295 IN CONST CHAR16
*Target
,