]> git.proxmox.com Git - mirror_edk2.git/blob - ShellPkg/Include/Library/ShellCommandLib.h
FileHandleLib - use standard unicode file tag.
[mirror_edk2.git] / ShellPkg / Include / Library / ShellCommandLib.h
1 /** @file
2 Provides interface to shell internal functions for shell commands.
3
4 This library is for use ONLY by shell commands linked into the shell application.
5 This library will not funciton if it is used for UEFI Shell 2.0 Applications.
6
7 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
8 This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php.
12
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15
16 **/
17
18 #ifndef _SHELL_COMMAND_LIB_
19 #define _SHELL_COMMAND_LIB_
20
21 #include <Uefi.h>
22 #include <ShellBase.h>
23
24 #include <Protocol/EfiShell.h>
25 #include <Protocol/EfiShellParameters.h>
26 #include <Protocol/UnicodeCollation.h>
27 #include <Protocol/DevicePathToText.h>
28 #include <Protocol/SimpleFileSystem.h>
29
30 #include <Library/UefiBootServicesTableLib.h>
31
32 //
33 // The extern global protocol poionters.
34 //
35 extern EFI_SHELL_PROTOCOL *gEfiShellProtocol;
36 extern EFI_SHELL_PARAMETERS_PROTOCOL *gEfiShellParametersProtocol;
37 extern EFI_UNICODE_COLLATION_PROTOCOL *gUnicodeCollation;
38 extern EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *gDevPathToText;
39 extern CONST CHAR16* SupportLevel[];
40
41 //
42 // The map list objects.
43 //
44 typedef struct {
45 LIST_ENTRY Link;
46 EFI_DEVICE_PATH_PROTOCOL *DevicePath;
47 CHAR16 *MapName;
48 CHAR16 *CurrentDirectoryPath;
49 UINT64 Flags;
50 } SHELL_MAP_LIST;
51 /// List of Mappings - DeviceName and Drive Letter(ism).
52 extern SHELL_MAP_LIST gShellMapList;
53 /// Pointer to node of current directory in the mMapList.
54 extern SHELL_MAP_LIST *gShellCurDir;
55
56 /**
57 Returns the help MAN fileName for a given shell command.
58
59 @retval !NULL The unicode string of the MAN filename.
60 @retval NULL An error ocurred.
61
62 **/
63 typedef
64 CONST CHAR16 *
65 (EFIAPI *SHELL_GET_MAN_FILENAME)(
66 VOID
67 );
68
69 /**
70 Runs a shell command on a given command line.
71
72 The specific operation of a given shell command is specified in the UEFI Shell
73 Specification 2.0, or in the source of the given command.
74
75 Upon completion of the command run the shell protocol and environment variables
76 may have been updated due to the operation.
77
78 @param[in] ImageHandle The ImageHandle to the app, or NULL if
79 the command built into shell.
80 @param[in] SystemTable The pointer to the system table.
81
82 @retval RETURN_SUCCESS The shell command was sucessful.
83 @retval RETURN_UNSUPPORTED The command is not supported.
84 **/
85 typedef
86 SHELL_STATUS
87 (EFIAPI *SHELL_RUN_COMMAND)(
88 IN EFI_HANDLE ImageHandle,
89 IN EFI_SYSTEM_TABLE *SystemTable
90 );
91
92 /**
93 Registers the handlers of type SHELL_RUN_COMMAND and
94 SHELL_GET_MAN_FILENAME for each shell command.
95
96 If the ShellSupportLevel is greater than the value of
97 PcdShellSupportLevel, then return RETURN_UNSUPPORTED.
98
99 Registers the the handlers specified by GetHelpInfoHandler and CommandHandler
100 with the command specified by CommandString. If the command named by
101 CommandString has already been registered, then return
102 RETURN_ALREADY_STARTED.
103
104 If there are not enough resources available to register the handlers, then
105 RETURN_OUT_OF_RESOURCES is returned.
106
107 If CommandString is NULL, then ASSERT().
108 If GetHelpInfoHandler is NULL, then ASSERT().
109 If CommandHandler is NULL, then ASSERT().
110 If ProfileName is NULL, then ASSERT().
111
112 @param[in] CommandString The pointer to the command name. This is the
113 name to look for on the command line in
114 the shell.
115 @param[in] CommandHandler The pointer to a function that runs the
116 specified command.
117 @param[in] GetManFileName The pointer to a function that provides man
118 filename.
119 @param[in] ShellMinSupportLevel The minimum Shell Support Level which has this
120 function.
121 @param[in] ProfileName The profile name to require for support of this
122 function.
123 @param[in] CanAffectLE Indicates whether this command's return value
124 can change the LASTERROR environment variable.
125 @param[in] HiiHandle The handle of this command's HII entry.
126 @param[in] ManFormatHelp The HII locator for the help text.
127
128 @retval RETURN_SUCCESS The handlers were registered.
129 @retval RETURN_OUT_OF_RESOURCES There are not enough resources available to
130 register the shell command.
131 @retval RETURN_UNSUPPORTED The ShellMinSupportLevel was higher than the
132 currently allowed support level.
133 @retval RETURN_ALREADY_STARTED The CommandString represents a command that
134 is already registered. Only one handler set for
135 a given command is allowed.
136 @sa SHELL_GET_MAN_FILENAME
137 @sa SHELL_RUN_COMMAND
138 **/
139 RETURN_STATUS
140 EFIAPI
141 ShellCommandRegisterCommandName (
142 IN CONST CHAR16 *CommandString,
143 IN SHELL_RUN_COMMAND CommandHandler,
144 IN SHELL_GET_MAN_FILENAME GetManFileName,
145 IN UINT32 ShellMinSupportLevel,
146 IN CONST CHAR16 *ProfileName,
147 IN CONST BOOLEAN CanAffectLE,
148 IN CONST EFI_HANDLE HiiHandle,
149 IN CONST EFI_STRING_ID ManFormatHelp
150 );
151
152 /**
153 Checks if a command string has been registered for CommandString, and if so, it runs
154 the previously registered handler for that command with the command line.
155
156 If CommandString is NULL, then ASSERT().
157
158 If Sections is specified, then each section name listed will be compared in a case sensitive
159 manner to the section names described in Appendix B UEFI Shell 2.0 Specification. If the section exists,
160 it is appended to the returned help text. If the section does not exist, no
161 information is returned. If Sections is NULL, then all help text information
162 available is returned.
163
164 @param[in] CommandString The pointer to the command name. This is the name
165 found on the command line in the shell.
166 @param[in,out] RetVal The pointer to the return value from the command handler.
167
168 @param[in,out] CanAffectLE Indicates whether this command's return value
169 needs to be placed into LASTERROR environment variable.
170
171 @retval RETURN_SUCCESS The handler was run.
172 @retval RETURN_NOT_FOUND The CommandString did not match a registered
173 command name.
174 @sa SHELL_RUN_COMMAND
175 **/
176 RETURN_STATUS
177 EFIAPI
178 ShellCommandRunCommandHandler (
179 IN CONST CHAR16 *CommandString,
180 IN OUT SHELL_STATUS *RetVal,
181 IN OUT BOOLEAN *CanAffectLE OPTIONAL
182 );
183
184 /**
185 Checks if a command string has been registered for CommandString, and if so, it
186 returns the MAN filename specified for that command.
187
188 If CommandString is NULL, then ASSERT().
189
190 @param[in] CommandString The pointer to the command name. This is the name
191 found on the command line in the shell.
192
193 @retval NULL The CommandString was not a registered command.
194 @retval other The name of the MAN file.
195 @sa SHELL_GET_MAN_FILENAME
196 **/
197 CONST CHAR16*
198 EFIAPI
199 ShellCommandGetManFileNameHandler (
200 IN CONST CHAR16 *CommandString
201 );
202
203
204 typedef struct {
205 LIST_ENTRY Link;
206 CHAR16 *CommandString;
207 } COMMAND_LIST;
208
209 /**
210 Get the list of all available shell internal commands. This is a linked list,
211 via the LIST_ENTRY structure. Enumerate through it using the BaseLib linked
212 list functions. Do not modify the values.
213
214 @param[in] Sort TRUE to alphabetically sort the values first. FALSE otherwise.
215
216 @return A linked list of all available shell commands.
217 **/
218 CONST COMMAND_LIST*
219 EFIAPI
220 ShellCommandGetCommandList (
221 IN CONST BOOLEAN Sort
222 );
223
224 typedef struct {
225 LIST_ENTRY Link;
226 CHAR16 *CommandString;
227 CHAR16 *Alias;
228 } ALIAS_LIST;
229
230 /**
231 Registers aliases to be set as part of the initialization of the shell application.
232
233 If Command is NULL, then ASSERT().
234 If Alias is NULL, then ASSERT().
235
236 @param[in] Command The pointer to the Command.
237 @param[in] Alias The pointer to Alias.
238
239 @retval RETURN_SUCCESS The handlers were registered.
240 @retval RETURN_OUT_OF_RESOURCES There are not enough resources available to
241 register the shell command.
242 **/
243 RETURN_STATUS
244 EFIAPI
245 ShellCommandRegisterAlias (
246 IN CONST CHAR16 *Command,
247 IN CONST CHAR16 *Alias
248 );
249
250 /**
251 Get the list of all shell alias commands. This is a linked list,
252 via LIST_ENTRY structure. Enumerate through it using the BaseLib linked
253 list functions. Do not modify the values.
254
255 @return A linked list of all requested shell aliases.
256 **/
257 CONST ALIAS_LIST*
258 EFIAPI
259 ShellCommandGetInitAliasList (
260 VOID
261 );
262
263 /**
264 Determine if a given alias is on the list of built in aliases.
265
266 @param[in] Alias The alias to test for.
267
268 @retval TRUE The alias is a built in alias.
269 @retval FALSE The alias is not a built in alias.
270 **/
271 BOOLEAN
272 EFIAPI
273 ShellCommandIsOnAliasList (
274 IN CONST CHAR16 *Alias
275 );
276
277 /**
278 Checks if a command is already on the list.
279
280 @param[in] CommandString The command string to check for on the list.
281
282 @retval TRUE CommandString represents a registered command.
283 @retval FALSE CommandString does not represent a registered command.
284 **/
285 BOOLEAN
286 EFIAPI
287 ShellCommandIsCommandOnList (
288 IN CONST CHAR16 *CommandString
289 );
290
291 /**
292 Get the help text for a command.
293
294 @param[in] CommandString The command name.
295
296 @retval NULL No help text was found.
297 @return The string of the help text. The caller required to free.
298 **/
299 CHAR16*
300 EFIAPI
301 ShellCommandGetCommandHelp (
302 IN CONST CHAR16 *CommandString
303 );
304
305 /**
306 Function to make sure that the above pointers are valid.
307 **/
308 EFI_STATUS
309 EFIAPI
310 CommandInit (
311 VOID
312 );
313
314 /**
315 Function to determine current state of ECHO. Echo determines if lines from scripts
316 and ECHO commands are enabled.
317
318 @retval TRUE Echo is currently enabled.
319 @retval FALSE Echo is currently disabled.
320 **/
321 BOOLEAN
322 EFIAPI
323 ShellCommandGetEchoState (
324 VOID
325 );
326
327 /**
328 Function to set current state of ECHO. Echo determines if lines from scripts
329 and ECHO commands are enabled.
330
331 @param[in] State TRUE to enable Echo, FALSE otherwise.
332 **/
333 VOID
334 EFIAPI
335 ShellCommandSetEchoState (
336 IN BOOLEAN State
337 );
338
339
340
341 /**
342 Indicate that the current shell or script should exit.
343
344 @param[in] ScriptOnly TRUE if exiting a script; FALSE otherwise.
345 **/
346 VOID
347 EFIAPI
348 ShellCommandRegisterExit (
349 IN BOOLEAN ScriptOnly
350 );
351
352 /**
353 Retrieve the Exit indicator.
354
355 @retval TRUE Exit was indicated.
356 @retval FALSE Exit was not indicated.
357 **/
358 BOOLEAN
359 EFIAPI
360 ShellCommandGetExit (
361 VOID
362 );
363
364 /**
365 Retrieve the Exit script indicator.
366
367 If ShellCommandGetExit returns FALSE, then the return from this is undefined.
368
369 @retval TRUE ScriptOnly was indicated.
370 @retval FALSE ScriptOnly was not indicated.
371 **/
372 BOOLEAN
373 EFIAPI
374 ShellCommandGetScriptExit (
375 VOID
376 );
377
378 typedef struct {
379 LIST_ENTRY Link; ///< List enumerator items.
380 UINTN Line; ///< What line of the script file this was on.
381 CHAR16 *Cl; ///< The original command line.
382 VOID *Data; ///< The data structure format dependant upon Command. (not always used)
383 BOOLEAN Reset; ///< Reset the command (it must be treated like a initial run (but it may have data already))
384 } SCRIPT_COMMAND_LIST;
385
386 typedef struct {
387 CHAR16 *ScriptName; ///< The filename of this script.
388 CHAR16 **Argv; ///< The parmameters to the script file.
389 UINTN Argc; ///< The count of parameters.
390 LIST_ENTRY CommandList; ///< The script converted to a list of commands (SCRIPT_COMMAND_LIST objects).
391 SCRIPT_COMMAND_LIST *CurrentCommand; ///< The command currently being operated. If !=NULL must be a member of CommandList.
392 LIST_ENTRY SubstList; ///< A list of current script loop alias' (ALIAS_LIST objects) (Used for the for %-based replacement).
393 } SCRIPT_FILE;
394
395 /**
396 Function to return a pointer to the currently running script file object.
397
398 @retval NULL A script file is not currently running.
399 @return A pointer to the current script file object.
400 **/
401 SCRIPT_FILE*
402 EFIAPI
403 ShellCommandGetCurrentScriptFile (
404 VOID
405 );
406
407 /**
408 Function to set a new script as the currently running one.
409
410 This function will correctly stack and unstack nested scripts.
411
412 @param[in] Script The pointer to new script information structure. If NULL,
413 it removes and de-allocates the topmost Script structure.
414
415 @return A pointer to the current running script file after this
416 change. It is NULL if removing the final script.
417 **/
418 SCRIPT_FILE*
419 EFIAPI
420 ShellCommandSetNewScript (
421 IN SCRIPT_FILE *Script OPTIONAL
422 );
423
424 /**
425 Function to cleanup all memory from a SCRIPT_FILE structure.
426
427 @param[in] Script The pointer to the structure to cleanup.
428 **/
429 VOID
430 EFIAPI
431 DeleteScriptFileStruct (
432 IN SCRIPT_FILE *Script
433 );
434
435 /**
436 Function to get the current Profile string.
437
438 This is used to retrieve what profiles were installed.
439
440 @retval NULL There are no installed profiles.
441 @return A semicolon-delimited list of profiles.
442 **/
443 CONST CHAR16 *
444 EFIAPI
445 ShellCommandGetProfileList (
446 VOID
447 );
448
449 typedef enum {
450 MappingTypeFileSystem,
451 MappingTypeBlockIo,
452 MappingTypeMax
453 } SHELL_MAPPING_TYPE;
454
455 /**
456 Function to generate the next default mapping name.
457
458 If the return value is not NULL then it must be callee freed.
459
460 @param Type What kind of mapping name to make.
461
462 @retval NULL a memory allocation failed.
463 @return a new map name string
464 **/
465 CHAR16*
466 EFIAPI
467 ShellCommandCreateNewMappingName(
468 IN CONST SHELL_MAPPING_TYPE Type
469 );
470
471 /**
472 Function to initialize the table for creating consistent map names.
473
474 @param[out] Table The pointer to pointer to pointer to DevicePathProtocol object.
475
476 @retval EFI_SUCCESS The table was created successfully.
477 **/
478 EFI_STATUS
479 EFIAPI
480 ShellCommandConsistMappingInitialize (
481 EFI_DEVICE_PATH_PROTOCOL ***Table
482 );
483
484 /**
485 Function to uninitialize the table for creating consistent map names.
486
487 The parameter must have been received from ShellCommandConsistMappingInitialize.
488
489 @param[out] Table The pointer to pointer to DevicePathProtocol object.
490
491 @retval EFI_SUCCESS The table was deleted successfully.
492 **/
493 EFI_STATUS
494 EFIAPI
495 ShellCommandConsistMappingUnInitialize (
496 EFI_DEVICE_PATH_PROTOCOL **Table
497 );
498
499 /**
500 Create a consistent mapped name for the device specified by DevicePath
501 based on the Table.
502
503 This must be called after ShellCommandConsistMappingInitialize() and
504 before ShellCommandConsistMappingUnInitialize() is called.
505
506 @param[in] DevicePath The pointer to the dev path for the device.
507 @param[in] Table The Table of mapping information.
508
509 @retval NULL A consistent mapped name could not be created.
510 @return A pointer to a string allocated from pool with the device name.
511 **/
512 CHAR16*
513 EFIAPI
514 ShellCommandConsistMappingGenMappingName (
515 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
516 IN EFI_DEVICE_PATH_PROTOCOL **Table
517 );
518
519 /**
520 Function to search the list of mappings for the first matching node on the
521 list based on the MapKey.
522
523 @param[in] MapKey The pointer to the string key to search for in the map.
524
525 @return the node on the list.
526 **/
527 SHELL_MAP_LIST*
528 EFIAPI
529 ShellCommandFindMapItem (
530 IN CONST CHAR16 *MapKey
531 );
532
533 /**
534 Function to add a map node to the list of map items and update the "path" environment variable (optionally).
535
536 If Path is TRUE (during initialization only), the path environment variable will also be updated to include
537 default paths on the new map name...
538
539 Path should be FALSE when this function is called from the protocol SetMap function.
540
541 @param[in] Name The human readable mapped name.
542 @param[in] DevicePath The Device Path for this map.
543 @param[in] Flags The Flags attribute for this map item.
544 @param[in] Path TRUE to update path, FALSE to skip this step (should only be TRUE during initialization).
545
546 @retval EFI_SUCCESS The addition was sucessful.
547 @retval EFI_OUT_OF_RESOURCES A memory allocation failed.
548 @retval EFI_INVALID_PARAMETER A parameter was invalid.
549 **/
550 EFI_STATUS
551 EFIAPI
552 ShellCommandAddMapItemAndUpdatePath(
553 IN CONST CHAR16 *Name,
554 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
555 IN CONST UINT64 Flags,
556 IN CONST BOOLEAN Path
557 );
558
559 /**
560 Creates the default map names for each device path in the system with
561 a protocol depending on the Type.
562
563 Also sets up the default path environment variable if Type is FileSystem.
564
565 @retval EFI_SUCCESS All map names were created sucessfully.
566 @retval EFI_NOT_FOUND No protocols were found in the system.
567 @return Error returned from gBS->LocateHandle().
568
569 @sa LocateHandle
570 **/
571 EFI_STATUS
572 EFIAPI
573 ShellCommandCreateInitialMappingsAndPaths(
574 VOID
575 );
576
577 /**
578 Function to standardize the directory indicators to \ characters.
579
580 @param[in,out] Path The pointer to the path string to fix.
581
582 @retval NULL The operation failed.
583 @return The Path pointer.
584 **/
585 CHAR16*
586 EFIAPI
587 ShellCommandCleanPath (
588 IN OUT CHAR16 *Path
589 );
590
591 /**
592 Converts a SHELL_FILE_HANDLE to an EFI_FILE_PROTOCOL*.
593
594 @param[in] Handle The SHELL_FILE_HANDLE to convert.
595
596 @return a EFI_FILE_PROTOCOL* representing the same file.
597 **/
598 EFI_FILE_PROTOCOL*
599 EFIAPI
600 ConvertShellHandleToEfiFileProtocol(
601 IN CONST SHELL_FILE_HANDLE Handle
602 );
603
604 /**
605 Remove a SHELL_FILE_HANDLE frmo the list of SHELL_FILE_HANDLES.
606
607 @param[in] Handle The SHELL_FILE_HANDLE to remove.
608
609 @retval TRUE The item was removed.
610 @retval FALSE The item was not found.
611 **/
612 BOOLEAN
613 EFIAPI
614 ShellFileHandleRemove(
615 IN CONST SHELL_FILE_HANDLE Handle
616 );
617
618 /**
619 Converts a EFI_FILE_PROTOCOL* to an SHELL_FILE_HANDLE.
620
621 @param[in] Handle The pointer to EFI_FILE_PROTOCOL to convert.
622 @param[in] Path The path to the file for verification.
623
624 @return a SHELL_FILE_HANDLE representing the same file.
625 **/
626 SHELL_FILE_HANDLE
627 EFIAPI
628 ConvertEfiFileProtocolToShellHandle(
629 IN CONST EFI_FILE_PROTOCOL *Handle,
630 IN CONST CHAR16 *Path
631 );
632
633 /**
634 Find the path that was logged with the specified SHELL_FILE_HANDLE.
635
636 @param[in] Handle The SHELL_FILE_HANDLE to query on.
637
638 @return A pointer to the path for the file.
639 **/
640 CONST CHAR16*
641 EFIAPI
642 ShellFileHandleGetPath(
643 IN CONST SHELL_FILE_HANDLE Handle
644 );
645
646
647 /**
648 Function to determine if a SHELL_FILE_HANDLE is at the end of the file.
649
650 This will NOT work on directories.
651
652 If Handle is NULL, then ASSERT.
653
654 @param[in] Handle the file handle
655
656 @retval TRUE the position is at the end of the file
657 @retval FALSE the position is not at the end of the file
658 **/
659 BOOLEAN
660 EFIAPI
661 ShellFileHandleEof(
662 IN SHELL_FILE_HANDLE Handle
663 );
664
665 /**
666 Function to read a single line from a SHELL_FILE_HANDLE. The \n is not included in the returned
667 buffer. The returned buffer must be callee freed.
668
669 If the position upon start is 0, then the Ascii Boolean will be set. This should be
670 maintained and not changed for all operations with the same file.
671
672 @param[in] Handle SHELL_FILE_HANDLE to read from.
673 @param[in,out] Ascii Boolean value for indicating whether the file is
674 Ascii (TRUE) or UCS2 (FALSE).
675
676 @return The line of text from the file.
677
678 @sa ShellFileHandleReadLine
679 **/
680 CHAR16*
681 EFIAPI
682 ShellFileHandleReturnLine(
683 IN SHELL_FILE_HANDLE Handle,
684 IN OUT BOOLEAN *Ascii
685 );
686
687 /**
688 Function to read a single line (up to but not including the \n) from a SHELL_FILE_HANDLE.
689
690 If the position upon start is 0, then the Ascii Boolean will be set. This should be
691 maintained and not changed for all operations with the same file.
692
693 @param[in] Handle SHELL_FILE_HANDLE to read from.
694 @param[in,out] Buffer The pointer to buffer to read into.
695 @param[in,out] Size The pointer to number of bytes in Buffer.
696 @param[in] Truncate If the buffer is large enough, this has no effect.
697 If the buffer is is too small and Truncate is TRUE,
698 the line will be truncated.
699 If the buffer is is too small and Truncate is FALSE,
700 then no read will occur.
701
702 @param[in,out] Ascii Boolean value for indicating whether the file is
703 Ascii (TRUE) or UCS2 (FALSE).
704
705 @retval EFI_SUCCESS The operation was successful. The line is stored in
706 Buffer.
707 @retval EFI_INVALID_PARAMETER Handle was NULL.
708 @retval EFI_INVALID_PARAMETER Size was NULL.
709 @retval EFI_BUFFER_TOO_SMALL Size was not large enough to store the line.
710 Size was updated to the minimum space required.
711 @sa ShellFileHandleRead
712 **/
713 EFI_STATUS
714 EFIAPI
715 ShellFileHandleReadLine(
716 IN SHELL_FILE_HANDLE Handle,
717 IN OUT CHAR16 *Buffer,
718 IN OUT UINTN *Size,
719 IN BOOLEAN Truncate,
720 IN OUT BOOLEAN *Ascii
721 );
722
723 typedef struct {
724 LIST_ENTRY Link;
725 void *Buffer;
726 } BUFFER_LIST;
727
728 /**
729 Frees any BUFFER_LIST defined type.
730
731 @param[in] List The pointer to the list head.
732 **/
733 VOID
734 EFIAPI
735 FreeBufferList (
736 IN BUFFER_LIST *List
737 );
738
739 /**
740 Chops off last directory or file entry in a path by changing the last '\' to a CHAR_NULL
741
742 @param[in,out] PathToReturn The pointer to the path to modify.
743
744 @retval FALSE No directory was found to chop off.
745 @retval TRUE A directory was chopped off.
746 **/
747 BOOLEAN
748 EFIAPI
749 ChopLastSlash(
750 IN OUT CHAR16 *PathToReturn
751 );
752
753 /**
754 Function to clean up paths. Removes the following items:
755 single periods in the path (no need for the current directory tag)
756 double periods in the path and removes a single parent directory.
757
758 This will be done inline and the resultant string may be be 'too big'.
759
760 @param[in] PathToReturn The pointer to the string containing the path.
761
762 @return PathToReturn is always returned.
763 **/
764 CHAR16*
765 EFIAPI
766 CleanPath(
767 IN CHAR16 *PathToReturn
768 );
769
770 #endif //_SHELL_COMMAND_LIB_