94b17fa1 |
1 | /** @file\r |
2 | Provides interface to shell functionality for shell commands and applications.\r |
3 | \r |
a31bd33c |
4 | Copyright (c) 2006 - 2009, Intel Corporation<BR>\r |
94b17fa1 |
5 | All rights reserved. This program and the accompanying materials\r |
6 | are licensed and made available under the terms and conditions of the BSD License\r |
7 | which accompanies this distribution. The full text of the license may be found at\r |
8 | http://opensource.org/licenses/bsd-license.php\r |
9 | \r |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r |
12 | \r |
13 | **/\r |
14 | \r |
15 | #if !defined(__SHELL_LIB__)\r |
16 | #define __SHELL_LIB__\r |
17 | \r |
18 | #include <Protocol/SimpleFileSystem.h>\r |
94b17fa1 |
19 | #include <Protocol/EfiShell.h>\r |
20 | \r |
21 | /**\r |
22 | This function will retrieve the information about the file for the handle \r |
23 | specified and store it in allocated pool memory.\r |
24 | \r |
69817bf8 |
25 | This function allocates a buffer to store the file's information. It is the \r |
26 | caller's responsibility to free the buffer\r |
94b17fa1 |
27 | \r |
28 | @param FileHandle The file handle of the file for which information is \r |
29 | being requested.\r |
30 | \r |
a5bd42b9 |
31 | @retval NULL information could not be retrieved.\r |
94b17fa1 |
32 | \r |
a5bd42b9 |
33 | @return the information about the file\r |
94b17fa1 |
34 | **/\r |
35 | EFI_FILE_INFO*\r |
36 | EFIAPI\r |
37 | ShellGetFileInfo (\r |
38 | IN EFI_FILE_HANDLE FileHandle\r |
39 | );\r |
40 | \r |
41 | /**\r |
42 | This function will set the information about the file for the opened handle \r |
43 | specified.\r |
44 | \r |
45 | @param FileHandle The file handle of the file for which information \r |
a5bd42b9 |
46 | is being set.\r |
94b17fa1 |
47 | \r |
48 | @param FileInfo The infotmation to set.\r |
49 | \r |
9eb53ac3 |
50 | @retval EFI_SUCCESS The information was set.\r |
94b17fa1 |
51 | @retval EFI_UNSUPPORTED The InformationType is not known.\r |
52 | @retval EFI_NO_MEDIA The device has no medium.\r |
53 | @retval EFI_DEVICE_ERROR The device reported an error.\r |
54 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r |
55 | @retval EFI_WRITE_PROTECTED The file or medium is write protected.\r |
56 | @retval EFI_ACCESS_DENIED The file was opened read only.\r |
57 | @retval EFI_VOLUME_FULL The volume is full.\r |
58 | **/\r |
59 | EFI_STATUS\r |
60 | EFIAPI\r |
61 | ShellSetFileInfo (\r |
62 | IN EFI_FILE_HANDLE FileHandle,\r |
63 | IN EFI_FILE_INFO *FileInfo\r |
64 | );\r |
65 | \r |
66 | /**\r |
67 | This function will open a file or directory referenced by DevicePath.\r |
68 | \r |
69 | This function opens a file with the open mode according to the file path. The \r |
70 | Attributes is valid only for EFI_FILE_MODE_CREATE.\r |
71 | \r |
125c2cf4 |
72 | @param FilePath On input the device path to the file. On output \r |
94b17fa1 |
73 | the remaining device path.\r |
74 | @param DeviceHandle pointer to the system device handle.\r |
75 | @param FileHandle pointer to the file handle.\r |
76 | @param OpenMode the mode to open the file with.\r |
77 | @param Attributes the file's file attributes.\r |
78 | \r |
79 | @retval EFI_SUCCESS The information was set.\r |
80 | @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.\r |
81 | @retval EFI_UNSUPPORTED Could not open the file path. \r |
82 | @retval EFI_NOT_FOUND The specified file could not be found on the \r |
83 | device or the file system could not be found on \r |
84 | the device.\r |
85 | @retval EFI_NO_MEDIA The device has no medium.\r |
86 | @retval EFI_MEDIA_CHANGED The device has a different medium in it or the \r |
87 | medium is no longer supported.\r |
88 | @retval EFI_DEVICE_ERROR The device reported an error.\r |
89 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r |
90 | @retval EFI_WRITE_PROTECTED The file or medium is write protected.\r |
91 | @retval EFI_ACCESS_DENIED The file was opened read only.\r |
92 | @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the \r |
93 | file.\r |
94 | @retval EFI_VOLUME_FULL The volume is full.\r |
95 | **/\r |
96 | EFI_STATUS\r |
97 | EFIAPI\r |
98 | ShellOpenFileByDevicePath(\r |
99 | IN OUT EFI_DEVICE_PATH_PROTOCOL **FilePath,\r |
100 | OUT EFI_HANDLE *DeviceHandle,\r |
101 | OUT EFI_FILE_HANDLE *FileHandle,\r |
102 | IN UINT64 OpenMode,\r |
103 | IN UINT64 Attributes\r |
104 | );\r |
105 | \r |
106 | /**\r |
107 | This function will open a file or directory referenced by filename.\r |
108 | \r |
69817bf8 |
109 | If return is EFI_SUCCESS, the Filehandle is the opened file's handle; \r |
94b17fa1 |
110 | otherwise, the Filehandle is NULL. The Attributes is valid only for \r |
111 | EFI_FILE_MODE_CREATE.\r |
112 | \r |
113 | @param FileName pointer to file name\r |
114 | @param FileHandle pointer to the file handle.\r |
115 | @param OpenMode the mode to open the file with.\r |
116 | @param Attributes the file's file attributes.\r |
117 | \r |
9eb53ac3 |
118 | @retval EFI_SUCCESS The information was set.\r |
94b17fa1 |
119 | @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.\r |
9eb53ac3 |
120 | @retval EFI_UNSUPPORTED Could not open the file path. \r |
94b17fa1 |
121 | @retval EFI_NOT_FOUND The specified file could not be found on the \r |
122 | device or the file system could not be found \r |
123 | on the device.\r |
9eb53ac3 |
124 | @retval EFI_NO_MEDIA The device has no medium.\r |
125 | @retval EFI_MEDIA_CHANGED The device has a different medium in it or the \r |
94b17fa1 |
126 | medium is no longer supported.\r |
9eb53ac3 |
127 | @retval EFI_DEVICE_ERROR The device reported an error.\r |
94b17fa1 |
128 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r |
9eb53ac3 |
129 | @retval EFI_WRITE_PROTECTED The file or medium is write protected.\r |
130 | @retval EFI_ACCESS_DENIED The file was opened read only.\r |
94b17fa1 |
131 | @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the \r |
132 | file.\r |
9eb53ac3 |
133 | @retval EFI_VOLUME_FULL The volume is full.\r |
94b17fa1 |
134 | **/\r |
135 | EFI_STATUS\r |
136 | EFIAPI\r |
137 | ShellOpenFileByName(\r |
b82bfcc1 |
138 | IN CONST CHAR16 *FilePath,\r |
94b17fa1 |
139 | OUT EFI_FILE_HANDLE *FileHandle,\r |
140 | IN UINT64 OpenMode,\r |
141 | IN UINT64 Attributes\r |
142 | );\r |
143 | \r |
144 | /**\r |
145 | This function create a directory\r |
146 | \r |
147 | If return is EFI_SUCCESS, the Filehandle is the opened directory's handle; \r |
148 | otherwise, the Filehandle is NULL. If the directory already existed, this \r |
149 | function opens the existing directory.\r |
150 | \r |
125c2cf4 |
151 | @param DirectoryName Pointer to Directory name.\r |
152 | @param FileHandle Pointer to the file handle.\r |
94b17fa1 |
153 | \r |
154 | @retval EFI_SUCCESS The information was set.\r |
155 | @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.\r |
125c2cf4 |
156 | @retval EFI_UNSUPPORTED Could not open the file path. \r |
94b17fa1 |
157 | @retval EFI_NOT_FOUND The specified file could not be found on the \r |
158 | device or the file system could not be found \r |
159 | on the device.\r |
9eb53ac3 |
160 | @retval EFI_NO_MEDIA The device has no medium.\r |
161 | @retval EFI_MEDIA_CHANGED The device has a different medium in it or the \r |
94b17fa1 |
162 | medium is no longer supported.\r |
9eb53ac3 |
163 | @retval EFI_DEVICE_ERROR The device reported an error.\r |
94b17fa1 |
164 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r |
9eb53ac3 |
165 | @retval EFI_WRITE_PROTECTED The file or medium is write protected.\r |
166 | @retval EFI_ACCESS_DENIED The file was opened read only.\r |
94b17fa1 |
167 | @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the \r |
168 | file.\r |
9eb53ac3 |
169 | @retval EFI_VOLUME_FULL The volume is full.\r |
94b17fa1 |
170 | **/\r |
171 | EFI_STATUS\r |
172 | EFIAPI\r |
173 | ShellCreateDirectory(\r |
b82bfcc1 |
174 | IN CONST CHAR16 *DirectoryName,\r |
94b17fa1 |
175 | OUT EFI_FILE_HANDLE *FileHandle\r |
176 | );\r |
177 | \r |
178 | /**\r |
179 | This function reads information from an opened file.\r |
180 | \r |
181 | If FileHandle is not a directory, the function reads the requested number of \r |
69817bf8 |
182 | bytes from the file at the file's current position and returns them in Buffer. \r |
94b17fa1 |
183 | If the read goes beyond the end of the file, the read length is truncated to the\r |
69817bf8 |
184 | end of the file. The file's current position is increased by the number of bytes \r |
94b17fa1 |
185 | returned. If FileHandle is a directory, the function reads the directory entry \r |
69817bf8 |
186 | at the file's current position and returns the entry in Buffer. If the Buffer \r |
94b17fa1 |
187 | is not large enough to hold the current directory entry, then \r |
188 | EFI_BUFFER_TOO_SMALL is returned and the current file position is not updated. \r |
189 | BufferSize is set to be the size of the buffer needed to read the entry. On \r |
190 | success, the current position is updated to the next directory entry. If there \r |
191 | are no more directory entries, the read returns a zero-length buffer. \r |
192 | EFI_FILE_INFO is the structure returned as the directory entry.\r |
193 | \r |
125c2cf4 |
194 | @param FileHandle The opened file handle.\r |
195 | @param ReadSize On input the size of buffer in bytes. On return \r |
94b17fa1 |
196 | the number of bytes written.\r |
125c2cf4 |
197 | @param Buffer The buffer to put read data into.\r |
94b17fa1 |
198 | \r |
125c2cf4 |
199 | @retval EFI_SUCCESS Data was read.\r |
200 | @retval EFI_NO_MEDIA The device has no media.\r |
201 | @retval EFI_DEVICE_ERROR The device reported an error.\r |
202 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r |
203 | @retval EFI_BUFFER_TO_SMALL Buffer is too small. ReadSize contains required \r |
94b17fa1 |
204 | size.\r |
205 | \r |
206 | **/\r |
207 | EFI_STATUS\r |
208 | EFIAPI\r |
209 | ShellReadFile(\r |
210 | IN EFI_FILE_HANDLE FileHandle,\r |
211 | IN OUT UINTN *ReadSize,\r |
212 | OUT VOID *Buffer\r |
213 | );\r |
214 | \r |
215 | /**\r |
216 | Write data to a file.\r |
217 | \r |
218 | This function writes the specified number of bytes to the file at the current \r |
219 | file position. The current file position is advanced the actual number of bytes \r |
220 | written, which is returned in BufferSize. Partial writes only occur when there \r |
69817bf8 |
221 | has been a data error during the write attempt (such as "volume space full"). \r |
94b17fa1 |
222 | The file is automatically grown to hold the data if required. Direct writes to \r |
223 | opened directories are not supported.\r |
224 | \r |
125c2cf4 |
225 | @param FileHandle The opened file for writing.\r |
94b17fa1 |
226 | \r |
125c2cf4 |
227 | @param BufferSize On input the number of bytes in Buffer. On output\r |
94b17fa1 |
228 | the number of bytes written.\r |
229 | \r |
125c2cf4 |
230 | @param Buffer The buffer containing data to write is stored.\r |
94b17fa1 |
231 | \r |
125c2cf4 |
232 | @retval EFI_SUCCESS Data was written.\r |
233 | @retval EFI_UNSUPPORTED Writes to an open directory are not supported.\r |
234 | @retval EFI_NO_MEDIA The device has no media.\r |
235 | @retval EFI_DEVICE_ERROR The device reported an error.\r |
236 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r |
237 | @retval EFI_WRITE_PROTECTED The device is write-protected.\r |
238 | @retval EFI_ACCESS_DENIED The file was open for read only.\r |
239 | @retval EFI_VOLUME_FULL The volume is full.\r |
94b17fa1 |
240 | **/\r |
241 | EFI_STATUS\r |
242 | EFIAPI\r |
243 | ShellWriteFile(\r |
244 | IN EFI_FILE_HANDLE FileHandle,\r |
245 | IN OUT UINTN *BufferSize,\r |
08d7f8e8 |
246 | IN VOID *Buffer\r |
94b17fa1 |
247 | );\r |
248 | \r |
249 | /** \r |
250 | Close an open file handle.\r |
251 | \r |
69817bf8 |
252 | This function closes a specified file handle. All "dirty" cached file data is \r |
94b17fa1 |
253 | flushed to the device, and the file is closed. In all cases the handle is \r |
254 | closed.\r |
255 | \r |
125c2cf4 |
256 | @param FileHandle The file handle to close.\r |
94b17fa1 |
257 | \r |
125c2cf4 |
258 | @retval EFI_SUCCESS The file handle was closed sucessfully.\r |
259 | @retval INVALID_PARAMETER One of the parameters has an invalid value.\r |
94b17fa1 |
260 | **/\r |
261 | EFI_STATUS\r |
262 | EFIAPI\r |
263 | ShellCloseFile (\r |
264 | IN EFI_FILE_HANDLE *FileHandle\r |
265 | );\r |
266 | \r |
267 | /**\r |
268 | Delete a file and close the handle\r |
269 | \r |
270 | This function closes and deletes a file. In all cases the file handle is closed.\r |
271 | If the file cannot be deleted, the warning code EFI_WARN_DELETE_FAILURE is \r |
272 | returned, but the handle is still closed.\r |
273 | \r |
125c2cf4 |
274 | @param FileHandle The file handle to delete.\r |
94b17fa1 |
275 | \r |
125c2cf4 |
276 | @retval EFI_SUCCESS The file was closed sucessfully.\r |
277 | @retval EFI_WARN_DELETE_FAILURE The handle was closed, but the file was not \r |
278 | deleted.\r |
279 | @retval INVALID_PARAMETER One of the parameters has an invalid value.\r |
94b17fa1 |
280 | **/\r |
281 | EFI_STATUS\r |
282 | EFIAPI\r |
283 | ShellDeleteFile (\r |
284 | IN EFI_FILE_HANDLE *FileHandle\r |
285 | );\r |
286 | \r |
287 | /**\r |
288 | Set the current position in a file.\r |
289 | \r |
290 | This function sets the current file position for the handle to the position \r |
291 | supplied. With the exception of seeking to position 0xFFFFFFFFFFFFFFFF, only\r |
292 | absolute positioning is supported, and seeking past the end of the file is \r |
293 | allowed (a subsequent write would grow the file). Seeking to position \r |
294 | 0xFFFFFFFFFFFFFFFF causes the current position to be set to the end of the file.\r |
295 | If FileHandle is a directory, the only position that may be set is zero. This \r |
296 | has the effect of starting the read process of the directory entries over.\r |
297 | \r |
298 | @param FileHandle The file handle on which the position is being set\r |
299 | \r |
300 | @param Position Byte position from begining of file\r |
301 | \r |
302 | @retval EFI_SUCCESS Operation completed sucessfully.\r |
303 | @retval EFI_UNSUPPORTED the seek request for non-zero is not valid on \r |
304 | directories.\r |
305 | @retval INVALID_PARAMETER One of the parameters has an invalid value.\r |
306 | **/\r |
307 | EFI_STATUS\r |
308 | EFIAPI\r |
309 | ShellSetFilePosition (\r |
310 | IN EFI_FILE_HANDLE FileHandle,\r |
311 | IN UINT64 Position\r |
312 | );\r |
313 | \r |
314 | /** \r |
315 | Gets a file's current position\r |
316 | \r |
317 | This function retrieves the current file position for the file handle. For \r |
318 | directories, the current file position has no meaning outside of the file \r |
319 | system driver and as such the operation is not supported. An error is returned\r |
320 | if FileHandle is a directory.\r |
321 | \r |
322 | @param FileHandle The open file handle on which to get the position.\r |
323 | @param Position Byte position from begining of file.\r |
324 | \r |
325 | @retval EFI_SUCCESS the operation completed sucessfully.\r |
326 | @retval INVALID_PARAMETER One of the parameters has an invalid value.\r |
327 | @retval EFI_UNSUPPORTED the request is not valid on directories.\r |
328 | **/\r |
329 | EFI_STATUS\r |
330 | EFIAPI\r |
331 | ShellGetFilePosition (\r |
332 | IN EFI_FILE_HANDLE FileHandle,\r |
333 | OUT UINT64 *Position\r |
334 | );\r |
335 | \r |
336 | /**\r |
337 | Flushes data on a file\r |
338 | \r |
339 | This function flushes all modified data associated with a file to a device.\r |
340 | \r |
341 | @param FileHandle The file handle on which to flush data\r |
342 | \r |
343 | @retval EFI_SUCCESS The data was flushed.\r |
344 | @retval EFI_NO_MEDIA The device has no media.\r |
345 | @retval EFI_DEVICE_ERROR The device reported an error.\r |
346 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r |
347 | @retval EFI_WRITE_PROTECTED The file or medium is write protected.\r |
348 | @retval EFI_ACCESS_DENIED The file was opened for read only.\r |
349 | **/\r |
350 | EFI_STATUS\r |
351 | EFIAPI\r |
352 | ShellFlushFile (\r |
353 | IN EFI_FILE_HANDLE FileHandle\r |
354 | );\r |
355 | \r |
356 | /**\r |
357 | Retrieves the first file from a directory\r |
358 | \r |
359 | This function takes an open directory handle and gets the first file \r |
360 | in the directory's info. Caller can use ShellFindNextFile() to get \r |
361 | subsequent files.\r |
362 | \r |
d2b4564b |
363 | Caller must use FreePool on *Buffer opon completion of all file searching.\r |
364 | \r |
94b17fa1 |
365 | @param DirHandle The file handle of the directory to search\r |
d2b4564b |
366 | @param Buffer Pointer to pointer to buffer for file's information\r |
94b17fa1 |
367 | \r |
368 | @retval EFI_SUCCESS Found the first file.\r |
369 | @retval EFI_NOT_FOUND Cannot find the directory.\r |
370 | @retval EFI_NO_MEDIA The device has no media.\r |
371 | @retval EFI_DEVICE_ERROR The device reported an error.\r |
372 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r |
373 | @return ShellReadFile\r |
374 | **/\r |
375 | EFI_STATUS\r |
376 | EFIAPI\r |
377 | ShellFindFirstFile (\r |
378 | IN EFI_FILE_HANDLE DirHandle,\r |
d2b4564b |
379 | OUT EFI_FILE_INFO **Buffer\r |
94b17fa1 |
380 | );\r |
381 | \r |
382 | /**\r |
383 | Retrieves the next file in a directory.\r |
384 | \r |
385 | To use this function, caller must call the ShellFindFirstFile() to get the \r |
386 | first file, and then use this function get other files. This function can be \r |
387 | called for several times to get each file's information in the directory. If \r |
388 | the call of ShellFindNextFile() got the last file in the directory, the next \r |
389 | call of this function has no file to get. *NoFile will be set to TRUE and the \r |
390 | data in Buffer is meaningless. \r |
391 | \r |
392 | @param DirHandle the file handle of the directory\r |
393 | @param Buffer pointer to buffer for file's information\r |
394 | @param NoFile pointer to boolean when last file is found\r |
395 | \r |
396 | @retval EFI_SUCCESS Found the next file.\r |
397 | @retval EFI_NO_MEDIA The device has no media.\r |
398 | @retval EFI_DEVICE_ERROR The device reported an error.\r |
399 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r |
400 | **/\r |
401 | EFI_STATUS\r |
402 | EFIAPI\r |
403 | ShellFindNextFile(\r |
404 | IN EFI_FILE_HANDLE DirHandle,\r |
405 | OUT EFI_FILE_INFO *Buffer,\r |
406 | OUT BOOLEAN *NoFile\r |
407 | );\r |
408 | \r |
409 | /**\r |
410 | Retrieve the size of a file.\r |
411 | \r |
69817bf8 |
412 | This function extracts the file size info from the FileHandle's EFI_FILE_INFO \r |
94b17fa1 |
413 | data.\r |
414 | \r |
125c2cf4 |
415 | @param FileHandle The file handle from which size is retrieved.\r |
416 | @param Size Pointer to size.\r |
94b17fa1 |
417 | \r |
125c2cf4 |
418 | @retval EFI_SUCCESS The operation was completed sucessfully.\r |
a31bd33c |
419 | @retval EFI_DEVICE_ERROR Cannot access the file.\r |
94b17fa1 |
420 | **/\r |
421 | EFI_STATUS\r |
422 | EFIAPI\r |
423 | ShellGetFileSize (\r |
424 | IN EFI_FILE_HANDLE FileHandle,\r |
425 | OUT UINT64 *Size\r |
426 | );\r |
427 | \r |
428 | /**\r |
429 | Retrieves the status of the break execution flag\r |
430 | \r |
431 | this function is useful to check whether the application is being asked to halt by the shell.\r |
432 | \r |
433 | @retval TRUE the execution break is enabled\r |
434 | @retval FALSE the execution break is not enabled\r |
435 | **/\r |
436 | BOOLEAN\r |
437 | EFIAPI\r |
438 | ShellGetExecutionBreakFlag(\r |
439 | VOID\r |
440 | );\r |
441 | \r |
442 | /**\r |
125c2cf4 |
443 | Return the value of an environment variable.\r |
94b17fa1 |
444 | \r |
125c2cf4 |
445 | This function gets the value of the environment variable set by the \r |
446 | ShellSetEnvironmentVariable function.\r |
94b17fa1 |
447 | \r |
448 | @param EnvKey The key name of the environment variable.\r |
449 | \r |
a31bd33c |
450 | @retval NULL The named environment variable does not exist.\r |
125c2cf4 |
451 | @return != NULL pointer to the value of the environment variable.\r |
94b17fa1 |
452 | **/\r |
453 | CONST CHAR16*\r |
454 | EFIAPI\r |
455 | ShellGetEnvironmentVariable (\r |
9b3bf083 |
456 | IN CONST CHAR16 *EnvKey\r |
94b17fa1 |
457 | );\r |
458 | \r |
459 | /**\r |
460 | set the value of an environment variable\r |
461 | \r |
125c2cf4 |
462 | This function changes the current value of the specified environment variable. If the\r |
463 | environment variable exists and the Value is an empty string, then the environment\r |
464 | variable is deleted. If the environment variable exists and the Value is not an empty\r |
465 | string, then the value of the environment variable is changed. If the environment\r |
466 | variable does not exist and the Value is an empty string, there is no action. If the\r |
467 | environment variable does not exist and the Value is a non-empty string, then the\r |
468 | environment variable is created and assigned the specified value.\r |
94b17fa1 |
469 | \r |
470 | This is not supported pre-UEFI Shell 2.0.\r |
471 | \r |
472 | @param EnvKey The key name of the environment variable.\r |
473 | @param EnvVal The Value of the environment variable\r |
474 | @param Volatile Indicates whether the variable is non-volatile (FALSE) or volatile (TRUE).\r |
475 | \r |
476 | @retval EFI_SUCCESS the operation was completed sucessfully\r |
477 | @retval EFI_UNSUPPORTED This operation is not allowed in pre UEFI 2.0 Shell environments\r |
478 | **/\r |
479 | EFI_STATUS\r |
480 | EFIAPI\r |
481 | ShellSetEnvironmentVariable (\r |
482 | IN CONST CHAR16 *EnvKey,\r |
483 | IN CONST CHAR16 *EnvVal,\r |
484 | IN BOOLEAN Volatile\r |
485 | );\r |
486 | \r |
487 | /**\r |
125c2cf4 |
488 | Cause the shell to parse and execute a command line.\r |
94b17fa1 |
489 | \r |
490 | This function creates a nested instance of the shell and executes the specified\r |
125c2cf4 |
491 | command (CommandLine) with the specified environment (Environment). Upon return,\r |
492 | the status code returned by the specified command is placed in StatusCode.\r |
493 | If Environment is NULL, then the current environment is used and all changes made\r |
494 | by the commands executed will be reflected in the current environment. If the\r |
495 | Environment is non-NULL, then the changes made will be discarded.\r |
496 | The CommandLine is executed from the current working directory on the current\r |
497 | device.\r |
94b17fa1 |
498 | \r |
125c2cf4 |
499 | EnvironmentVariables and Status are only supported for UEFI Shell 2.0.\r |
500 | Output is only supported for pre-UEFI Shell 2.0\r |
94b17fa1 |
501 | \r |
a31bd33c |
502 | @param ImageHandle Parent image that is starting the operation.\r |
503 | @param CommandLine Pointer to null terminated command line.\r |
504 | @param Output True to display debug output. false to hide it.\r |
505 | @param EnvironmentVariables Optional pointer to array of environment variables\r |
506 | in the form "x=y". If NULL current set is used.\r |
507 | @param Status The status of the run command line.\r |
94b17fa1 |
508 | \r |
a31bd33c |
509 | @retval EFI_SUCCESS The operation completed sucessfully. Status\r |
94b17fa1 |
510 | contains the status code returned.\r |
a31bd33c |
511 | @retval EFI_INVALID_PARAMETER A parameter contains an invalid value.\r |
512 | @retval EFI_OUT_OF_RESOURCES Out of resources.\r |
513 | @retval EFI_UNSUPPORTED The operation is not allowed.\r |
94b17fa1 |
514 | **/\r |
515 | EFI_STATUS\r |
516 | EFIAPI\r |
517 | ShellExecute (\r |
518 | IN EFI_HANDLE *ParentHandle,\r |
519 | IN CHAR16 *CommandLine,\r |
520 | IN BOOLEAN Output,\r |
521 | IN CHAR16 **EnvironmentVariables,\r |
522 | OUT EFI_STATUS *Status\r |
523 | );\r |
524 | \r |
525 | /**\r |
a31bd33c |
526 | Retreives the current directory path.\r |
94b17fa1 |
527 | \r |
69817bf8 |
528 | If the DeviceName is NULL, it returns the current device's current directory \r |
94b17fa1 |
529 | name. If the DeviceName is not NULL, it returns the current directory name \r |
530 | on specified drive.\r |
531 | \r |
a31bd33c |
532 | @param DeviceName The name of the file system to get directory on.\r |
94b17fa1 |
533 | \r |
a31bd33c |
534 | @retval NULL The directory does not exist.\r |
535 | @return != NULL The directory.\r |
94b17fa1 |
536 | **/\r |
537 | CONST CHAR16*\r |
538 | EFIAPI\r |
539 | ShellGetCurrentDir (\r |
540 | IN CHAR16 *DeviceName OPTIONAL\r |
541 | );\r |
542 | \r |
543 | /**\r |
125c2cf4 |
544 | Sets (enabled or disabled) the page break mode.\r |
94b17fa1 |
545 | \r |
125c2cf4 |
546 | When page break mode is enabled the screen will stop scrolling \r |
94b17fa1 |
547 | and wait for operator input before scrolling a subsequent screen.\r |
548 | \r |
a31bd33c |
549 | @param CurrentState TRUE to enable and FALSE to disable.\r |
94b17fa1 |
550 | **/\r |
551 | VOID \r |
552 | EFIAPI\r |
553 | ShellSetPageBreakMode (\r |
554 | IN BOOLEAN CurrentState\r |
555 | );\r |
556 | \r |
557 | /**\r |
558 | Opens a group of files based on a path.\r |
559 | \r |
560 | This function uses the Arg to open all the matching files. Each matched \r |
561 | file has a SHELL_FILE_ARG structure to record the file information. These \r |
562 | structures are placed on the list ListHead. Users can get the SHELL_FILE_ARG \r |
563 | structures from ListHead to access each file. This function supports wildcards\r |
125c2cf4 |
564 | and will process '?' and '*' as such. The list must be freed with a call to \r |
94b17fa1 |
565 | ShellCloseFileMetaArg().\r |
566 | \r |
eb646684 |
567 | If you are NOT appending to an existing list *ListHead must be NULL. If \r |
568 | *ListHead is NULL then it must be callee freed.\r |
94b17fa1 |
569 | \r |
125c2cf4 |
570 | @param Arg Pointer to path string.\r |
571 | @param OpenMode Mode to open files with.\r |
572 | @param ListHead Head of linked list of results.\r |
94b17fa1 |
573 | \r |
125c2cf4 |
574 | @retval EFI_SUCCESS The operation was sucessful and the list head \r |
575 | contains the list of opened files.\r |
a31bd33c |
576 | @retval != EFI_SUCCESS The operation failed.\r |
94b17fa1 |
577 | \r |
578 | @sa InternalShellConvertFileListType\r |
579 | **/\r |
580 | EFI_STATUS\r |
581 | EFIAPI\r |
582 | ShellOpenFileMetaArg (\r |
583 | IN CHAR16 *Arg,\r |
584 | IN UINT64 OpenMode,\r |
585 | IN OUT EFI_SHELL_FILE_INFO **ListHead\r |
586 | );\r |
587 | \r |
588 | /**\r |
a31bd33c |
589 | Free the linked list returned from ShellOpenFileMetaArg.\r |
94b17fa1 |
590 | \r |
a31bd33c |
591 | @param ListHead The pointer to free.\r |
94b17fa1 |
592 | \r |
a31bd33c |
593 | @retval EFI_SUCCESS The operation was sucessful.\r |
594 | @retval EFI_INVALID_PARAMETER A parameter was invalid.\r |
94b17fa1 |
595 | **/\r |
596 | EFI_STATUS\r |
597 | EFIAPI\r |
598 | ShellCloseFileMetaArg (\r |
599 | IN OUT EFI_SHELL_FILE_INFO **ListHead\r |
600 | );\r |
601 | \r |
125c2cf4 |
602 | /**\r |
603 | Find a file by searching the CWD and then the path.\r |
604 | \r |
a31bd33c |
605 | If FileName is NULL, then ASSERT.\r |
125c2cf4 |
606 | \r |
a31bd33c |
607 | If the return value is not NULL then the memory must be caller freed.\r |
125c2cf4 |
608 | \r |
609 | @param FileName Filename string.\r |
610 | \r |
a31bd33c |
611 | @retval NULL The file was not found.\r |
612 | @return !NULL The path to the file.\r |
125c2cf4 |
613 | **/\r |
614 | CHAR16 *\r |
615 | EFIAPI\r |
616 | ShellFindFilePath (\r |
617 | IN CONST CHAR16 *FileName\r |
618 | );\r |
619 | \r |
94b17fa1 |
620 | typedef enum {\r |
a31bd33c |
621 | TypeFlag = 0, ///< a flag that is present or not present only (IE "-a").\r |
622 | TypeValue, ///< a flag that has some data following it with a space (IE "-a 1").\r |
623 | TypePosition, ///< some data that did not follow a parameter (IE "filename.txt").\r |
624 | TypeStart, ///< a flag that has variable value appended to the end (IE "-ad", "-afd", "-adf", etc...).\r |
625 | TypeDoubleValue, ///< a flag that has 2 space seperated value data following it (IE "-a 1 2").\r |
626 | TypeMaxValue, ///< a flag followed by all the command line data before the next flag.\r |
94b17fa1 |
627 | TypeMax,\r |
628 | } ParamType;\r |
629 | \r |
630 | typedef struct {\r |
631 | CHAR16 *Name;\r |
632 | ParamType Type;\r |
633 | } SHELL_PARAM_ITEM;\r |
634 | \r |
d2b4564b |
635 | \r |
636 | /// Helper structure for no parameters (besides -? and -b)\r |
637 | extern SHELL_PARAM_ITEM EmptyParamList[];\r |
638 | \r |
94b17fa1 |
639 | /**\r |
640 | Checks the command line arguments passed against the list of valid ones. \r |
641 | Optionally removes NULL values first.\r |
642 | \r |
643 | If no initialization is required, then return RETURN_SUCCESS.\r |
644 | \r |
125c2cf4 |
645 | @param CheckList Pointer to list of parameters to check.\r |
646 | @param CheckPackage Package of checked values.\r |
a31bd33c |
647 | @param ProblemParam Optional pointer to pointer to unicode string for \r |
94b17fa1 |
648 | the paramater that caused failure.\r |
125c2cf4 |
649 | @param AutoPageBreak Will automatically set PageBreakEnabled.\r |
94b17fa1 |
650 | \r |
651 | @retval EFI_SUCCESS The operation completed sucessfully.\r |
a31bd33c |
652 | @retval EFI_OUT_OF_RESOURCES A memory allocation failed.\r |
653 | @retval EFI_INVALID_PARAMETER A parameter was invalid.\r |
654 | @retval EFI_VOLUME_CORRUPTED The command line was corrupt. an argument was \r |
655 | duplicated. The duplicated command line argument \r |
94b17fa1 |
656 | was returned in ProblemParam if provided.\r |
a31bd33c |
657 | @retval EFI_DEVICE_ERROR The commands contained 2 opposing arguments. One\r |
94b17fa1 |
658 | of the command line arguments was returned in \r |
659 | ProblemParam if provided.\r |
125c2cf4 |
660 | @retval EFI_NOT_FOUND A argument required a value that was missing. \r |
a31bd33c |
661 | The invalid command line argument was returned in\r |
94b17fa1 |
662 | ProblemParam if provided.\r |
663 | **/\r |
664 | EFI_STATUS\r |
665 | EFIAPI\r |
2247dde4 |
666 | ShellCommandLineParseEx (\r |
94b17fa1 |
667 | IN CONST SHELL_PARAM_ITEM *CheckList,\r |
668 | OUT LIST_ENTRY **CheckPackage,\r |
669 | OUT CHAR16 **ProblemParam OPTIONAL,\r |
2247dde4 |
670 | IN BOOLEAN AutoPageBreak,\r |
671 | IN BOOLEAN AlwaysAllowNumbers\r |
94b17fa1 |
672 | );\r |
673 | \r |
a31bd33c |
674 | /// make it easy to upgrade from older versions of the shell library.\r |
2247dde4 |
675 | #define ShellCommandLineParse(CheckList,CheckPackage,ProblemParam,AutoPageBreak) ShellCommandLineParseEx(CheckList,CheckPackage,ProblemParam,AutoPageBreak,FALSE)\r |
676 | \r |
94b17fa1 |
677 | /**\r |
678 | Frees shell variable list that was returned from ShellCommandLineParse.\r |
679 | \r |
680 | This function will free all the memory that was used for the CheckPackage\r |
681 | list of postprocessed shell arguments.\r |
682 | \r |
a31bd33c |
683 | If CheckPackage is NULL, then return.\r |
94b17fa1 |
684 | \r |
a31bd33c |
685 | @param CheckPackage The list to de-allocate.\r |
94b17fa1 |
686 | **/\r |
687 | VOID\r |
688 | EFIAPI\r |
689 | ShellCommandLineFreeVarList (\r |
690 | IN LIST_ENTRY *CheckPackage\r |
691 | );\r |
692 | \r |
693 | /**\r |
a31bd33c |
694 | Checks for presence of a flag parameter.\r |
94b17fa1 |
695 | \r |
696 | flag arguments are in the form of "-<Key>" or "/<Key>", but do not have a value following the key\r |
697 | \r |
698 | if CheckPackage is NULL then return FALSE.\r |
a31bd33c |
699 | if KeyString is NULL then ASSERT().\r |
94b17fa1 |
700 | \r |
a31bd33c |
701 | @param CheckPackage The package of parsed command line arguments.\r |
702 | @param KeyString The Key of the command line argument to check for.\r |
94b17fa1 |
703 | \r |
a31bd33c |
704 | @retval TRUE The flag is on the command line.\r |
705 | @retval FALSE The flag is not on the command line.\r |
94b17fa1 |
706 | **/\r |
707 | BOOLEAN\r |
708 | EFIAPI\r |
709 | ShellCommandLineGetFlag (\r |
710 | IN CONST LIST_ENTRY *CheckPackage,\r |
711 | IN CHAR16 *KeyString\r |
712 | );\r |
713 | \r |
714 | /**\r |
a31bd33c |
715 | Returns value from command line argument.\r |
94b17fa1 |
716 | \r |
a31bd33c |
717 | Value parameters are in the form of "-<Key> value" or "/<Key> value"\r |
94b17fa1 |
718 | \r |
a31bd33c |
719 | If CheckPackage is NULL, then return NULL.\r |
94b17fa1 |
720 | \r |
36a9d672 |
721 | @param[in] CheckPackage The package of parsed command line arguments.\r |
722 | @param[in] KeyString The Key of the command line argument to check for.\r |
94b17fa1 |
723 | \r |
a31bd33c |
724 | @retval NULL The flag is not on the command line.\r |
725 | @retval !=NULL Pointer to unicode string of the value.\r |
94b17fa1 |
726 | **/\r |
727 | CONST CHAR16*\r |
728 | EFIAPI\r |
729 | ShellCommandLineGetValue (\r |
730 | IN CONST LIST_ENTRY *CheckPackage,\r |
731 | IN CHAR16 *KeyString\r |
732 | );\r |
733 | \r |
734 | /**\r |
a31bd33c |
735 | Returns raw value from command line argument.\r |
94b17fa1 |
736 | \r |
a31bd33c |
737 | Raw value parameters are in the form of "value" in a specific position in the list.\r |
94b17fa1 |
738 | \r |
36a9d672 |
739 | If CheckPackage is NULL, then return NULL.\r |
94b17fa1 |
740 | \r |
36a9d672 |
741 | @param[in] CheckPackage The package of parsed command line arguments.\r |
742 | @param[in] Position The position of the value.\r |
94b17fa1 |
743 | \r |
a31bd33c |
744 | @retval NULL The flag is not on the command line.\r |
745 | @retval !=NULL Pointer to unicode string of the value.\r |
94b17fa1 |
746 | **/\r |
747 | CONST CHAR16*\r |
748 | EFIAPI\r |
749 | ShellCommandLineGetRawValue (\r |
750 | IN CONST LIST_ENTRY *CheckPackage,\r |
751 | IN UINT32 Position\r |
752 | );\r |
753 | \r |
2247dde4 |
754 | /**\r |
a31bd33c |
755 | Returns the number of command line value parameters that were parsed. \r |
2247dde4 |
756 | \r |
a31bd33c |
757 | This will not include flags.\r |
2247dde4 |
758 | \r |
759 | @retval (UINTN)-1 No parsing has ocurred\r |
a31bd33c |
760 | @return The number of value parameters found\r |
2247dde4 |
761 | **/\r |
762 | UINTN\r |
763 | EFIAPI\r |
764 | ShellCommandLineGetCount(\r |
765 | VOID\r |
766 | );\r |
767 | \r |
36a9d672 |
768 | /**\r |
769 | Determins if a parameter is duplicated.\r |
770 | \r |
771 | If Param is not NULL then it will point to a callee allocated string buffer \r |
772 | with the parameter value if a duplicate is found.\r |
773 | \r |
774 | If CheckPackage is NULL, then ASSERT.\r |
775 | \r |
776 | @param[in] CheckPackage The package of parsed command line arguments.\r |
777 | @param[out] Param Upon finding one, a pointer to the duplicated parameter.\r |
778 | \r |
779 | @retval EFI_SUCCESS No parameters were duplicated.\r |
780 | @retval EFI_DEVICE_ERROR A duplicate was found.\r |
781 | **/\r |
782 | EFI_STATUS\r |
783 | EFIAPI\r |
784 | ShellCommandLineCheckDuplicate (\r |
785 | IN CONST LIST_ENTRY *CheckPackage,\r |
786 | OUT CHAR16 **Param\r |
787 | );\r |
788 | \r |
d2b4564b |
789 | /**\r |
790 | This function causes the shell library to initialize itself. If the shell library\r |
791 | is already initialized it will de-initialize all the current protocol poitners and\r |
792 | re-populate them again.\r |
793 | \r |
794 | When the library is used with PcdShellLibAutoInitialize set to true this function\r |
795 | will return EFI_SUCCESS and perform no actions.\r |
796 | \r |
797 | This function is intended for internal access for shell commands only.\r |
798 | \r |
799 | @retval EFI_SUCCESS the initialization was complete sucessfully\r |
800 | \r |
801 | **/\r |
802 | EFI_STATUS\r |
803 | EFIAPI\r |
804 | ShellInitialize (\r |
125c2cf4 |
805 | VOID\r |
d2b4564b |
806 | );\r |
807 | \r |
b1f95a06 |
808 | /**\r |
809 | Print at a specific location on the screen.\r |
810 | \r |
a5bd42b9 |
811 | This function will move the cursor to a given screen location and print the specified string.\r |
b1f95a06 |
812 | \r |
813 | If -1 is specified for either the Row or Col the current screen location for BOTH \r |
a5bd42b9 |
814 | will be used.\r |
b1f95a06 |
815 | \r |
a31bd33c |
816 | If either Row or Col is out of range for the current console, then ASSERT.\r |
817 | If Format is NULL, then ASSERT.\r |
b1f95a06 |
818 | \r |
819 | In addition to the standard %-based flags as supported by UefiLib Print() this supports \r |
820 | the following additional flags:\r |
821 | %N - Set output attribute to normal\r |
822 | %H - Set output attribute to highlight\r |
823 | %E - Set output attribute to error\r |
824 | %B - Set output attribute to blue color\r |
825 | %V - Set output attribute to green color\r |
826 | \r |
827 | Note: The background color is controlled by the shell command cls.\r |
828 | \r |
829 | @param[in] Row the row to print at\r |
830 | @param[in] Col the column to print at\r |
831 | @param[in] Format the format string\r |
832 | \r |
833 | @return the number of characters printed to the screen\r |
834 | **/\r |
835 | \r |
836 | UINTN\r |
837 | EFIAPI\r |
838 | ShellPrintEx(\r |
839 | IN INT32 Col OPTIONAL,\r |
840 | IN INT32 Row OPTIONAL,\r |
841 | IN CONST CHAR16 *Format,\r |
842 | ...\r |
843 | );\r |
844 | \r |
2247dde4 |
845 | /**\r |
846 | Print at a specific location on the screen.\r |
847 | \r |
a5bd42b9 |
848 | This function will move the cursor to a given screen location and print the specified string.\r |
2247dde4 |
849 | \r |
850 | If -1 is specified for either the Row or Col the current screen location for BOTH \r |
a5bd42b9 |
851 | will be used.\r |
2247dde4 |
852 | \r |
a5bd42b9 |
853 | If either Row or Col is out of range for the current console, then ASSERT.\r |
854 | If Format is NULL, then ASSERT.\r |
2247dde4 |
855 | \r |
856 | In addition to the standard %-based flags as supported by UefiLib Print() this supports \r |
857 | the following additional flags:\r |
858 | %N - Set output attribute to normal\r |
859 | %H - Set output attribute to highlight\r |
860 | %E - Set output attribute to error\r |
861 | %B - Set output attribute to blue color\r |
862 | %V - Set output attribute to green color\r |
863 | \r |
864 | Note: The background color is controlled by the shell command cls.\r |
865 | \r |
866 | @param[in] Row the row to print at\r |
867 | @param[in] Col the column to print at\r |
868 | @param[in] HiiFormatStringId the format string Id for getting from Hii\r |
869 | @param[in] HiiFormatHandle the format string Handle for getting from Hii\r |
870 | \r |
871 | @return the number of characters printed to the screen\r |
872 | **/\r |
873 | UINTN\r |
874 | EFIAPI\r |
875 | ShellPrintHiiEx(\r |
876 | IN INT32 Col OPTIONAL,\r |
877 | IN INT32 Row OPTIONAL,\r |
878 | IN CONST EFI_STRING_ID HiiFormatStringId,\r |
879 | IN CONST EFI_HANDLE HiiFormatHandle,\r |
880 | ...\r |
881 | );\r |
882 | \r |
883 | /**\r |
a31bd33c |
884 | Function to determine if a given filename represents a directory.\r |
2247dde4 |
885 | \r |
886 | @param[in] DirName Path to directory to test.\r |
887 | \r |
a31bd33c |
888 | @retval EFI_SUCCESS The Path represents a directory.\r |
889 | @retval EFI_NOT_FOUND The Path does not represent a directory.\r |
890 | @retval other The path failed to open.\r |
2247dde4 |
891 | **/\r |
892 | EFI_STATUS\r |
893 | EFIAPI\r |
894 | ShellIsDirectory(\r |
895 | IN CONST CHAR16 *DirName\r |
896 | );\r |
897 | \r |
a31bd33c |
898 | /**\r |
899 | Function to determine if a given filename represents a file.\r |
900 | \r |
901 | @param[in] Name Path to file to test.\r |
902 | \r |
903 | @retval EFI_SUCCESS The Path represents a file.\r |
904 | @retval EFI_NOT_FOUND The Path does not represent a file.\r |
905 | @retval other The path failed to open.\r |
906 | **/\r |
907 | EFI_STATUS\r |
908 | EFIAPI\r |
909 | ShellIsFile(\r |
910 | IN CONST CHAR16 *Name\r |
911 | );\r |
912 | \r |
125c2cf4 |
913 | /**\r |
914 | Function to determine whether a string is decimal or hex representation of a number \r |
915 | and return the number converted from the string.\r |
916 | \r |
917 | @param[in] String String representation of a number\r |
918 | \r |
a31bd33c |
919 | @return The unsigned integer result of the conversion.\r |
125c2cf4 |
920 | **/\r |
921 | UINTN\r |
922 | EFIAPI\r |
923 | ShellStrToUintn(\r |
924 | IN CONST CHAR16 *String\r |
925 | );\r |
926 | \r |
927 | /**\r |
928 | Safely append with automatic string resizing given length of Destination and \r |
929 | desired length of copy from Source.\r |
930 | \r |
a31bd33c |
931 | Append the first D characters of Source to the end of Destination, where D is \r |
125c2cf4 |
932 | the lesser of Count and the StrLen() of Source. If appending those D characters \r |
933 | will fit within Destination (whose Size is given as CurrentSize) and \r |
934 | still leave room for a null terminator, then those characters are appended, \r |
935 | starting at the original terminating null of Destination, and a new terminating \r |
936 | null is appended.\r |
937 | \r |
938 | If appending D characters onto Destination will result in a overflow of the size\r |
939 | given in CurrentSize the string will be grown such that the copy can be performed\r |
940 | and CurrentSize will be updated to the new size.\r |
941 | \r |
942 | If Source is NULL, there is nothing to append, just return the current buffer in \r |
943 | Destination.\r |
944 | \r |
a31bd33c |
945 | if Destination is NULL, then ASSERT().\r |
125c2cf4 |
946 | if Destination's current length (including NULL terminator) is already more then \r |
a31bd33c |
947 | CurrentSize, then ASSERT().\r |
125c2cf4 |
948 | \r |
a31bd33c |
949 | @param[in,out] Destination The String to append onto.\r |
950 | @param[in,out] CurrentSize On call the number of bytes in Destination. On \r |
125c2cf4 |
951 | return possibly the new size (still in bytes). if NULL\r |
952 | then allocate whatever is needed.\r |
a31bd33c |
953 | @param[in] Source The String to append from.\r |
954 | @param[in] Count Maximum number of characters to append. If 0 then \r |
125c2cf4 |
955 | all are appended.\r |
956 | \r |
a31bd33c |
957 | @return the Destination after apending the Source.\r |
125c2cf4 |
958 | **/\r |
959 | CHAR16* \r |
960 | EFIAPI\r |
961 | StrnCatGrow (\r |
962 | IN OUT CHAR16 **Destination,\r |
963 | IN OUT UINTN *CurrentSize,\r |
964 | IN CONST CHAR16 *Source,\r |
965 | IN UINTN Count\r |
966 | );\r |
2247dde4 |
967 | \r |
e9880e25 |
968 | #endif // __SHELL_LIB__\r |