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