]> git.proxmox.com Git - mirror_edk2.git/blob - ShellPkg/Include/Library/ShellLib.h
e08cc884524354fb14a6adf0b4e5ad8c7736eb2c
[mirror_edk2.git] / ShellPkg / Include / Library / ShellLib.h
1 /** @file
2 Provides interface to shell functionality for shell commands and applications.
3
4 Copyright (c) 2006 - 2009, Intel Corporation
5 All rights reserved. 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
15 #if !defined(__SHELL_LIB__)
16 #define __SHELL_LIB__
17
18 #include <Protocol/SimpleFileSystem.h>
19 #include <Protocol/EfiShell.h>
20
21 /**
22 This function will retrieve the information about the file for the handle
23 specified and store it in allocated pool memory.
24
25 This function allocates a buffer to store the file's information. It is the
26 caller's responsibility to free the buffer
27
28 @param FileHandle The file handle of the file for which information is
29 being requested.
30
31 @retval NULL information could not be retrieved.
32
33 @return the information about the file
34 **/
35 EFI_FILE_INFO*
36 EFIAPI
37 ShellGetFileInfo (
38 IN EFI_FILE_HANDLE FileHandle
39 );
40
41 /**
42 This function will set the information about the file for the opened handle
43 specified.
44
45 @param FileHandle The file handle of the file for which information
46 is being set
47
48 @param FileInfo The infotmation to set.
49
50 @retval EFI_SUCCESS The information was set.
51 @retval EFI_UNSUPPORTED The InformationType is not known.
52 @retval EFI_NO_MEDIA The device has no medium.
53 @retval EFI_DEVICE_ERROR The device reported an error.
54 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
55 @retval EFI_WRITE_PROTECTED The file or medium is write protected.
56 @retval EFI_ACCESS_DENIED The file was opened read only.
57 @retval EFI_VOLUME_FULL The volume is full.
58 **/
59 EFI_STATUS
60 EFIAPI
61 ShellSetFileInfo (
62 IN EFI_FILE_HANDLE FileHandle,
63 IN EFI_FILE_INFO *FileInfo
64 );
65
66 /**
67 This function will open a file or directory referenced by DevicePath.
68
69 This function opens a file with the open mode according to the file path. The
70 Attributes is valid only for EFI_FILE_MODE_CREATE.
71
72 @param FilePath on input the device path to the file. On output
73 the remaining device path.
74 @param DeviceHandle pointer to the system device handle.
75 @param FileHandle pointer to the file handle.
76 @param OpenMode the mode to open the file with.
77 @param Attributes the file's file attributes.
78
79 @retval EFI_SUCCESS The information was set.
80 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
81 @retval EFI_UNSUPPORTED Could not open the file path.
82 @retval EFI_NOT_FOUND The specified file could not be found on the
83 device or the file system could not be found on
84 the device.
85 @retval EFI_NO_MEDIA The device has no medium.
86 @retval EFI_MEDIA_CHANGED The device has a different medium in it or the
87 medium is no longer supported.
88 @retval EFI_DEVICE_ERROR The device reported an error.
89 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
90 @retval EFI_WRITE_PROTECTED The file or medium is write protected.
91 @retval EFI_ACCESS_DENIED The file was opened read only.
92 @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the
93 file.
94 @retval EFI_VOLUME_FULL The volume is full.
95 **/
96 EFI_STATUS
97 EFIAPI
98 ShellOpenFileByDevicePath(
99 IN OUT EFI_DEVICE_PATH_PROTOCOL **FilePath,
100 OUT EFI_HANDLE *DeviceHandle,
101 OUT EFI_FILE_HANDLE *FileHandle,
102 IN UINT64 OpenMode,
103 IN UINT64 Attributes
104 );
105
106 /**
107 This function will open a file or directory referenced by filename.
108
109 If return is EFI_SUCCESS, the Filehandle is the opened file's handle;
110 otherwise, the Filehandle is NULL. The Attributes is valid only for
111 EFI_FILE_MODE_CREATE.
112
113 @param FileName pointer to file name
114 @param FileHandle pointer to the file handle.
115 @param OpenMode the mode to open the file with.
116 @param Attributes the file's file attributes.
117
118 @retval EFI_SUCCESS The information was set.
119 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
120 @retval EFI_UNSUPPORTED Could not open the file path.
121 @retval EFI_NOT_FOUND The specified file could not be found on the
122 device or the file system could not be found
123 on the device.
124 @retval EFI_NO_MEDIA The device has no medium.
125 @retval EFI_MEDIA_CHANGED The device has a different medium in it or the
126 medium is no longer supported.
127 @retval EFI_DEVICE_ERROR The device reported an error.
128 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
129 @retval EFI_WRITE_PROTECTED The file or medium is write protected.
130 @retval EFI_ACCESS_DENIED The file was opened read only.
131 @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the
132 file.
133 @retval EFI_VOLUME_FULL The volume is full.
134 **/
135 EFI_STATUS
136 EFIAPI
137 ShellOpenFileByName(
138 IN CONST CHAR16 *FilePath,
139 OUT EFI_FILE_HANDLE *FileHandle,
140 IN UINT64 OpenMode,
141 IN UINT64 Attributes
142 );
143
144 /**
145 This function create a directory
146
147 If return is EFI_SUCCESS, the Filehandle is the opened directory's handle;
148 otherwise, the Filehandle is NULL. If the directory already existed, this
149 function opens the existing directory.
150
151 @param DirectoryName pointer to Directory name
152 @param FileHandle pointer to the file handle.
153
154 @retval EFI_SUCCESS The information was set.
155 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
156 @retval EFI_UNSUPPORTED Could not open the file path.
157 @retval EFI_NOT_FOUND The specified file could not be found on the
158 device or the file system could not be found
159 on the device.
160 @retval EFI_NO_MEDIA The device has no medium.
161 @retval EFI_MEDIA_CHANGED The device has a different medium in it or the
162 medium is no longer supported.
163 @retval EFI_DEVICE_ERROR The device reported an error.
164 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
165 @retval EFI_WRITE_PROTECTED The file or medium is write protected.
166 @retval EFI_ACCESS_DENIED The file was opened read only.
167 @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the
168 file.
169 @retval EFI_VOLUME_FULL The volume is full.
170 **/
171 EFI_STATUS
172 EFIAPI
173 ShellCreateDirectory(
174 IN CONST CHAR16 *DirectoryName,
175 OUT EFI_FILE_HANDLE *FileHandle
176 );
177
178 /**
179 This function reads information from an opened file.
180
181 If FileHandle is not a directory, the function reads the requested number of
182 bytes from the file at the file's current position and returns them in Buffer.
183 If the read goes beyond the end of the file, the read length is truncated to the
184 end of the file. The file's current position is increased by the number of bytes
185 returned. If FileHandle is a directory, the function reads the directory entry
186 at the file's current position and returns the entry in Buffer. If the Buffer
187 is not large enough to hold the current directory entry, then
188 EFI_BUFFER_TOO_SMALL is returned and the current file position is not updated.
189 BufferSize is set to be the size of the buffer needed to read the entry. On
190 success, the current position is updated to the next directory entry. If there
191 are no more directory entries, the read returns a zero-length buffer.
192 EFI_FILE_INFO is the structure returned as the directory entry.
193
194 @param FileHandle the opened file handle
195
196 @param ReadSize on input the size of buffer in bytes. on return
197 the number of bytes written.
198
199 @param Buffer the buffer to put read data into.
200
201 @retval EFI_SUCCESS Data was read.
202 @retval EFI_NO_MEDIA The device has no media.
203 @retval EFI_DEVICE_ERROR The device reported an error.
204 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
205 @retval EFI_BUFFER_TO_SMALL Buffer is too small. ReadSize contains required
206 size.
207
208 **/
209 EFI_STATUS
210 EFIAPI
211 ShellReadFile(
212 IN EFI_FILE_HANDLE FileHandle,
213 IN OUT UINTN *ReadSize,
214 OUT VOID *Buffer
215 );
216
217 /**
218 Write data to a file.
219
220 This function writes the specified number of bytes to the file at the current
221 file position. The current file position is advanced the actual number of bytes
222 written, which is returned in BufferSize. Partial writes only occur when there
223 has been a data error during the write attempt (such as "volume space full").
224 The file is automatically grown to hold the data if required. Direct writes to
225 opened directories are not supported.
226
227 @param FileHandle The opened file for writing
228
229 @param BufferSize on input the number of bytes in Buffer. On output
230 the number of bytes written.
231
232 @param Buffer the buffer containing data to write is stored.
233
234 @retval EFI_SUCCESS Data was written.
235 @retval EFI_UNSUPPORTED Writes to an open directory are not supported.
236 @retval EFI_NO_MEDIA The device has no media.
237 @retval EFI_DEVICE_ERROR The device reported an error.
238 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
239 @retval EFI_WRITE_PROTECTED The device is write-protected.
240 @retval EFI_ACCESS_DENIED The file was open for read only.
241 @retval EFI_VOLUME_FULL The volume is full.
242 **/
243 EFI_STATUS
244 EFIAPI
245 ShellWriteFile(
246 IN EFI_FILE_HANDLE FileHandle,
247 IN OUT UINTN *BufferSize,
248 IN VOID *Buffer
249 );
250
251 /**
252 Close an open file handle.
253
254 This function closes a specified file handle. All "dirty" cached file data is
255 flushed to the device, and the file is closed. In all cases the handle is
256 closed.
257
258 @param FileHandle the file handle to close.
259
260 @retval EFI_SUCCESS the file handle was closed sucessfully.
261 @retval INVALID_PARAMETER One of the parameters has an invalid value.
262 **/
263 EFI_STATUS
264 EFIAPI
265 ShellCloseFile (
266 IN EFI_FILE_HANDLE *FileHandle
267 );
268
269 /**
270 Delete a file and close the handle
271
272 This function closes and deletes a file. In all cases the file handle is closed.
273 If the file cannot be deleted, the warning code EFI_WARN_DELETE_FAILURE is
274 returned, but the handle is still closed.
275
276 @param FileHandle the file handle to delete
277
278 @retval EFI_SUCCESS the file was closed sucessfully
279 @retval EFI_WARN_DELETE_FAILURE the handle was closed, but the file was not
280 deleted
281 @retval INVALID_PARAMETER One of the parameters has an invalid value.
282 **/
283 EFI_STATUS
284 EFIAPI
285 ShellDeleteFile (
286 IN EFI_FILE_HANDLE *FileHandle
287 );
288
289 /**
290 Set the current position in a file.
291
292 This function sets the current file position for the handle to the position
293 supplied. With the exception of seeking to position 0xFFFFFFFFFFFFFFFF, only
294 absolute positioning is supported, and seeking past the end of the file is
295 allowed (a subsequent write would grow the file). Seeking to position
296 0xFFFFFFFFFFFFFFFF causes the current position to be set to the end of the file.
297 If FileHandle is a directory, the only position that may be set is zero. This
298 has the effect of starting the read process of the directory entries over.
299
300 @param FileHandle The file handle on which the position is being set
301
302 @param Position Byte position from begining of file
303
304 @retval EFI_SUCCESS Operation completed sucessfully.
305 @retval EFI_UNSUPPORTED the seek request for non-zero is not valid on
306 directories.
307 @retval INVALID_PARAMETER One of the parameters has an invalid value.
308 **/
309 EFI_STATUS
310 EFIAPI
311 ShellSetFilePosition (
312 IN EFI_FILE_HANDLE FileHandle,
313 IN UINT64 Position
314 );
315
316 /**
317 Gets a file's current position
318
319 This function retrieves the current file position for the file handle. For
320 directories, the current file position has no meaning outside of the file
321 system driver and as such the operation is not supported. An error is returned
322 if FileHandle is a directory.
323
324 @param FileHandle The open file handle on which to get the position.
325 @param Position Byte position from begining of file.
326
327 @retval EFI_SUCCESS the operation completed sucessfully.
328 @retval INVALID_PARAMETER One of the parameters has an invalid value.
329 @retval EFI_UNSUPPORTED the request is not valid on directories.
330 **/
331 EFI_STATUS
332 EFIAPI
333 ShellGetFilePosition (
334 IN EFI_FILE_HANDLE FileHandle,
335 OUT UINT64 *Position
336 );
337
338 /**
339 Flushes data on a file
340
341 This function flushes all modified data associated with a file to a device.
342
343 @param FileHandle The file handle on which to flush data
344
345 @retval EFI_SUCCESS The data was flushed.
346 @retval EFI_NO_MEDIA The device has no media.
347 @retval EFI_DEVICE_ERROR The device reported an error.
348 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
349 @retval EFI_WRITE_PROTECTED The file or medium is write protected.
350 @retval EFI_ACCESS_DENIED The file was opened for read only.
351 **/
352 EFI_STATUS
353 EFIAPI
354 ShellFlushFile (
355 IN EFI_FILE_HANDLE FileHandle
356 );
357
358 /**
359 Retrieves the first file from a directory
360
361 This function takes an open directory handle and gets the first file
362 in the directory's info. Caller can use ShellFindNextFile() to get
363 subsequent files.
364
365 Caller must use FreePool on *Buffer opon completion of all file searching.
366
367 @param DirHandle The file handle of the directory to search
368 @param Buffer Pointer to pointer to buffer for file's information
369
370 @retval EFI_SUCCESS Found the first file.
371 @retval EFI_NOT_FOUND Cannot find the directory.
372 @retval EFI_NO_MEDIA The device has no media.
373 @retval EFI_DEVICE_ERROR The device reported an error.
374 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
375 @return ShellReadFile
376 **/
377 EFI_STATUS
378 EFIAPI
379 ShellFindFirstFile (
380 IN EFI_FILE_HANDLE DirHandle,
381 OUT EFI_FILE_INFO **Buffer
382 );
383
384 /**
385 Retrieves the next file in a directory.
386
387 To use this function, caller must call the ShellFindFirstFile() to get the
388 first file, and then use this function get other files. This function can be
389 called for several times to get each file's information in the directory. If
390 the call of ShellFindNextFile() got the last file in the directory, the next
391 call of this function has no file to get. *NoFile will be set to TRUE and the
392 data in Buffer is meaningless.
393
394 @param DirHandle the file handle of the directory
395 @param Buffer pointer to buffer for file's information
396 @param NoFile pointer to boolean when last file is found
397
398 @retval EFI_SUCCESS Found the next file.
399 @retval EFI_NO_MEDIA The device has no media.
400 @retval EFI_DEVICE_ERROR The device reported an error.
401 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
402 **/
403 EFI_STATUS
404 EFIAPI
405 ShellFindNextFile(
406 IN EFI_FILE_HANDLE DirHandle,
407 OUT EFI_FILE_INFO *Buffer,
408 OUT BOOLEAN *NoFile
409 );
410
411 /**
412 Retrieve the size of a file.
413
414 This function extracts the file size info from the FileHandle's EFI_FILE_INFO
415 data.
416
417 @param FileHandle file handle from which size is retrieved
418 @param Size pointer to size
419
420 @retval EFI_SUCCESS operation was completed sucessfully
421 @retval EFI_DEVICE_ERROR cannot access the file
422 **/
423 EFI_STATUS
424 EFIAPI
425 ShellGetFileSize (
426 IN EFI_FILE_HANDLE FileHandle,
427 OUT UINT64 *Size
428 );
429
430 /**
431 Retrieves the status of the break execution flag
432
433 this function is useful to check whether the application is being asked to halt by the shell.
434
435 @retval TRUE the execution break is enabled
436 @retval FALSE the execution break is not enabled
437 **/
438 BOOLEAN
439 EFIAPI
440 ShellGetExecutionBreakFlag(
441 VOID
442 );
443
444 /**
445 return the value of an environment variable
446
447 this function gets the value of the environment variable set by the
448 ShellSetEnvironmentVariable function
449
450 @param EnvKey The key name of the environment variable.
451
452 @retval NULL the named environment variable does not exist.
453 @return != NULL pointer to the value of the environment variable
454 **/
455 CONST CHAR16*
456 EFIAPI
457 ShellGetEnvironmentVariable (
458 IN CONST CHAR16 *EnvKey
459 );
460
461 /**
462 set the value of an environment variable
463
464 This function changes the current value of the specified environment variable. If the
465 environment variable exists and the Value is an empty string, then the environment
466 variable is deleted. If the environment variable exists and the Value is not an empty
467 string, then the value of the environment variable is changed. If the environment
468 variable does not exist and the Value is an empty string, there is no action. If the
469 environment variable does not exist and the Value is a non-empty string, then the
470 environment variable is created and assigned the specified value.
471
472 This is not supported pre-UEFI Shell 2.0.
473
474 @param EnvKey The key name of the environment variable.
475 @param EnvVal The Value of the environment variable
476 @param Volatile Indicates whether the variable is non-volatile (FALSE) or volatile (TRUE).
477
478 @retval EFI_SUCCESS the operation was completed sucessfully
479 @retval EFI_UNSUPPORTED This operation is not allowed in pre UEFI 2.0 Shell environments
480 **/
481 EFI_STATUS
482 EFIAPI
483 ShellSetEnvironmentVariable (
484 IN CONST CHAR16 *EnvKey,
485 IN CONST CHAR16 *EnvVal,
486 IN BOOLEAN Volatile
487 );
488
489 /**
490 cause the shell to parse and execute a command line.
491
492 This function creates a nested instance of the shell and executes the specified
493 command (CommandLine) with the specified environment (Environment). Upon return,
494 the status code returned by the specified command is placed in StatusCode.
495 If Environment is NULL, then the current environment is used and all changes made
496 by the commands executed will be reflected in the current environment. If the
497 Environment is non-NULL, then the changes made will be discarded.
498 The CommandLine is executed from the current working directory on the current
499 device.
500
501 EnvironmentVariables and Status are only supported for UEFI Shell 2.0.
502 Output is only supported for pre-UEFI Shell 2.0
503
504 @param ImageHandle Parent image that is starting the operation
505 @param CommandLine pointer to null terminated command line.
506 @param Output true to display debug output. false to hide it.
507 @param EnvironmentVariables optional pointer to array of environment variables
508 in the form "x=y". if NULL current set is used.
509 @param Status the status of the run command line.
510
511 @retval EFI_SUCCESS the operation completed sucessfully. Status
512 contains the status code returned.
513 @retval EFI_INVALID_PARAMETER a parameter contains an invalid value
514 @retval EFI_OUT_OF_RESOURCES out of resources
515 @retval EFI_UNSUPPORTED the operation is not allowed.
516 **/
517 EFI_STATUS
518 EFIAPI
519 ShellExecute (
520 IN EFI_HANDLE *ParentHandle,
521 IN CHAR16 *CommandLine,
522 IN BOOLEAN Output,
523 IN CHAR16 **EnvironmentVariables,
524 OUT EFI_STATUS *Status
525 );
526
527 /**
528 Retreives the current directory path
529
530 If the DeviceName is NULL, it returns the current device's current directory
531 name. If the DeviceName is not NULL, it returns the current directory name
532 on specified drive.
533
534 @param DeviceName the name of the drive to get directory on
535
536 @retval NULL the directory does not exist
537 @return != NULL the directory
538 **/
539 CONST CHAR16*
540 EFIAPI
541 ShellGetCurrentDir (
542 IN CHAR16 *DeviceName OPTIONAL
543 );
544
545 /**
546 sets (enabled or disabled) the page break mode
547
548 when page break mode is enabled the screen will stop scrolling
549 and wait for operator input before scrolling a subsequent screen.
550
551 @param CurrentState TRUE to enable and FALSE to disable
552 **/
553 VOID
554 EFIAPI
555 ShellSetPageBreakMode (
556 IN BOOLEAN CurrentState
557 );
558
559 /**
560 Opens a group of files based on a path.
561
562 This function uses the Arg to open all the matching files. Each matched
563 file has a SHELL_FILE_ARG structure to record the file information. These
564 structures are placed on the list ListHead. Users can get the SHELL_FILE_ARG
565 structures from ListHead to access each file. This function supports wildcards
566 and will process '?' and '*' as such. the list must be freed with a call to
567 ShellCloseFileMetaArg().
568
569 If you are NOT appending to an existing list *ListHead must be NULL. If
570 *ListHead is NULL then it must be callee freed.
571
572 @param Arg pointer to path string
573 @param OpenMode mode to open files with
574 @param ListHead head of linked list of results
575
576 @retval EFI_SUCCESS the operation was sucessful and the list head
577 contains the list of opened files
578 #retval EFI_UNSUPPORTED a previous ShellOpenFileMetaArg must be closed first.
579 *ListHead is set to NULL.
580 @return != EFI_SUCCESS the operation failed
581
582 @sa InternalShellConvertFileListType
583 **/
584 EFI_STATUS
585 EFIAPI
586 ShellOpenFileMetaArg (
587 IN CHAR16 *Arg,
588 IN UINT64 OpenMode,
589 IN OUT EFI_SHELL_FILE_INFO **ListHead
590 );
591
592 /**
593 Free the linked list returned from ShellOpenFileMetaArg
594
595 @param ListHead the pointer to free
596
597 @retval EFI_SUCCESS the operation was sucessful
598 @retval EFI_INVALID_PARAMETER A parameter was invalid
599 **/
600 EFI_STATUS
601 EFIAPI
602 ShellCloseFileMetaArg (
603 IN OUT EFI_SHELL_FILE_INFO **ListHead
604 );
605
606 typedef enum {
607 TypeFlag = 0,
608 TypeValue,
609 TypePosition,
610 TypeStart,
611 TypeMax,
612 } ParamType;
613
614 typedef struct {
615 CHAR16 *Name;
616 ParamType Type;
617 } SHELL_PARAM_ITEM;
618
619
620 /// Helper structure for no parameters (besides -? and -b)
621 extern SHELL_PARAM_ITEM EmptyParamList[];
622
623 /**
624 Checks the command line arguments passed against the list of valid ones.
625 Optionally removes NULL values first.
626
627 If no initialization is required, then return RETURN_SUCCESS.
628
629 @param CheckList pointer to list of parameters to check
630 @param CheckPackage Package of checked values
631 @param ProblemParam optional pointer to pointer to unicode string for
632 the paramater that caused failure.
633 @param AutoPageBreak will automatically set PageBreakEnabled
634
635 @retval EFI_SUCCESS The operation completed sucessfully.
636 @retval EFI_OUT_OF_RESOURCES A memory allocation failed
637 @retval EFI_INVALID_PARAMETER A parameter was invalid
638 @retval EFI_VOLUME_CORRUPTED the command line was corrupt. an argument was
639 duplicated. the duplicated command line argument
640 was returned in ProblemParam if provided.
641 @retval EFI_DEVICE_ERROR the commands contained 2 opposing arguments. one
642 of the command line arguments was returned in
643 ProblemParam if provided.
644 @retval EFI_NOT_FOUND a argument required a value that was missing.
645 the invalid command line argument was returned in
646 ProblemParam if provided.
647 **/
648 EFI_STATUS
649 EFIAPI
650 ShellCommandLineParse (
651 IN CONST SHELL_PARAM_ITEM *CheckList,
652 OUT LIST_ENTRY **CheckPackage,
653 OUT CHAR16 **ProblemParam OPTIONAL,
654 IN BOOLEAN AutoPageBreak
655 );
656
657 /**
658 Frees shell variable list that was returned from ShellCommandLineParse.
659
660 This function will free all the memory that was used for the CheckPackage
661 list of postprocessed shell arguments.
662
663 this function has no return value.
664
665 if CheckPackage is NULL, then return
666
667 @param CheckPackage the list to de-allocate
668 **/
669 VOID
670 EFIAPI
671 ShellCommandLineFreeVarList (
672 IN LIST_ENTRY *CheckPackage
673 );
674
675 /**
676 Checks for presence of a flag parameter
677
678 flag arguments are in the form of "-<Key>" or "/<Key>", but do not have a value following the key
679
680 if CheckPackage is NULL then return FALSE.
681 if KeyString is NULL then ASSERT()
682
683 @param CheckPackage The package of parsed command line arguments
684 @param KeyString the Key of the command line argument to check for
685
686 @retval TRUE the flag is on the command line
687 @retval FALSE the flag is not on the command line
688 **/
689 BOOLEAN
690 EFIAPI
691 ShellCommandLineGetFlag (
692 IN CONST LIST_ENTRY *CheckPackage,
693 IN CHAR16 *KeyString
694 );
695
696 /**
697 returns value from command line argument
698
699 value parameters are in the form of "-<Key> value" or "/<Key> value"
700
701 if CheckPackage is NULL, then return NULL;
702
703 @param CheckPackage The package of parsed command line arguments
704 @param KeyString the Key of the command line argument to check for
705
706 @retval NULL the flag is not on the command line
707 @return !=NULL pointer to unicode string of the value
708 **/
709 CONST CHAR16*
710 EFIAPI
711 ShellCommandLineGetValue (
712 IN CONST LIST_ENTRY *CheckPackage,
713 IN CHAR16 *KeyString
714 );
715
716 /**
717 returns raw value from command line argument
718
719 raw value parameters are in the form of "value" in a specific position in the list
720
721 if CheckPackage is NULL, then return NULL;
722
723 @param CheckPackage The package of parsed command line arguments
724 @param Position the position of the value
725
726 @retval NULL the flag is not on the command line
727 @return !=NULL pointer to unicode string of the value
728 **/
729 CONST CHAR16*
730 EFIAPI
731 ShellCommandLineGetRawValue (
732 IN CONST LIST_ENTRY *CheckPackage,
733 IN UINT32 Position
734 );
735
736 /**
737 This function causes the shell library to initialize itself. If the shell library
738 is already initialized it will de-initialize all the current protocol poitners and
739 re-populate them again.
740
741 When the library is used with PcdShellLibAutoInitialize set to true this function
742 will return EFI_SUCCESS and perform no actions.
743
744 This function is intended for internal access for shell commands only.
745
746 @retval EFI_SUCCESS the initialization was complete sucessfully
747
748 **/
749 EFI_STATUS
750 EFIAPI
751 ShellInitialize (
752 );
753
754 /**
755 Print at a specific location on the screen.
756
757 This function will move the cursor to a given screen location, print the specified string,
758 and return the cursor to the original locaiton.
759
760 If -1 is specified for either the Row or Col the current screen location for BOTH
761 will be used and the cursor's position will not be moved back to an original location.
762
763 if either Row or Col is out of range for the current console, then ASSERT
764 if Format is NULL, then ASSERT
765
766 In addition to the standard %-based flags as supported by UefiLib Print() this supports
767 the following additional flags:
768 %N - Set output attribute to normal
769 %H - Set output attribute to highlight
770 %E - Set output attribute to error
771 %B - Set output attribute to blue color
772 %V - Set output attribute to green color
773
774 Note: The background color is controlled by the shell command cls.
775
776 @param[in] Row the row to print at
777 @param[in] Col the column to print at
778 @param[in] Format the format string
779
780 @return the number of characters printed to the screen
781 **/
782
783 UINTN
784 EFIAPI
785 ShellPrintEx(
786 IN INT32 Col OPTIONAL,
787 IN INT32 Row OPTIONAL,
788 IN CONST CHAR16 *Format,
789 ...
790 );
791
792 #endif // __SHELL_LIB__