diff options
author | jcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-06-30 22:58:53 +0000 |
---|---|---|
committer | jcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-06-30 22:58:53 +0000 |
commit | ab94587a7d2cd89695f9190420daceae0d2b7446 (patch) | |
tree | d736759dc8ce225a8c7d1aa699703e6ca37a4a7e /ShellPkg/Include | |
parent | f1518f69703e1086f346a6e9d8e5a59855954178 (diff) | |
download | edk2-ab94587a7d2cd89695f9190420daceae0d2b7446.tar.gz edk2-ab94587a7d2cd89695f9190420daceae0d2b7446.tar.bz2 edk2-ab94587a7d2cd89695f9190420daceae0d2b7446.zip |
This refactors 3 functions out of ShellCommandLib and puts them into a new library (but as 2 functions instead of 3). This allows for users outside of the shell itself to have access to these functions.
1) Remove the 3 functions out of the shell's internal library (ShellCommandLib)
2) Add a new library class (PathLib)
3) Add an instance of this class (BasePathLib)
4) Change all internal shell callers to use this new library class.
signed-off-by: jcarsey
reviewed-by: jljusten
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11936 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ShellPkg/Include')
-rw-r--r-- | ShellPkg/Include/Library/PathLib.h | 56 | ||||
-rw-r--r-- | ShellPkg/Include/Library/ShellCommandLib.h | 45 |
2 files changed, 56 insertions, 45 deletions
diff --git a/ShellPkg/Include/Library/PathLib.h b/ShellPkg/Include/Library/PathLib.h new file mode 100644 index 0000000000..912b1f14b0 --- /dev/null +++ b/ShellPkg/Include/Library/PathLib.h @@ -0,0 +1,56 @@ +/** @file
+ Provides interface to path manipulation functions.
+
+ Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php.
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+**/
+
+#ifndef _PATH_LIB_
+#define _PATH_LIB_
+
+#include <Base.h>
+#include <Library/BaseMemoryLib.h>
+
+/**
+ Removes the last directory or file entry in a path by changing the last
+ L'\' to a CHAR_NULL.
+
+ @param[in,out] Path The pointer to the path to modify.
+
+ @retval FALSE Nothing was found to remove.
+ @retval TRUE A directory or file was removed.
+**/
+BOOLEAN
+EFIAPI
+PathRemoveLastItem(
+ IN OUT CHAR16 *Path
+ );
+
+/**
+ Function to clean up paths.
+
+ - Single periods in the path are removed.
+ - Double periods in the path are removed along with a single parent directory.
+ - Forward slashes L'/' are converted to backward slashes L'\'.
+
+ This will be done inline and the existing buffer may be larger than required
+ upon completion.
+
+ @param[in] Path The pointer to the string containing the path.
+
+ @retval NULL An error occured.
+ @return Path in all other instances.
+**/
+CHAR16*
+EFIAPI
+PathCleanUpDirectories(
+ IN CHAR16 *Path
+ );
+
+#endif //_PATH_LIB_
diff --git a/ShellPkg/Include/Library/ShellCommandLib.h b/ShellPkg/Include/Library/ShellCommandLib.h index 027c0caad5..e998ac51b9 100644 --- a/ShellPkg/Include/Library/ShellCommandLib.h +++ b/ShellPkg/Include/Library/ShellCommandLib.h @@ -573,20 +573,6 @@ ShellCommandCreateInitialMappingsAndPaths( );
/**
- Function to standardize the directory indicators to \ characters.
-
- @param[in,out] Path The pointer to the path string to fix.
-
- @retval NULL The operation failed.
- @return The Path pointer.
-**/
-CHAR16*
-EFIAPI
-ShellCommandCleanPath (
- IN OUT CHAR16 *Path
- );
-
-/**
Converts a SHELL_FILE_HANDLE to an EFI_FILE_PROTOCOL*.
@param[in] Handle The SHELL_FILE_HANDLE to convert.
@@ -734,35 +720,4 @@ FreeBufferList ( IN BUFFER_LIST *List
);
-/**
- Chops off last directory or file entry in a path by changing the last '\' to a CHAR_NULL
-
- @param[in,out] PathToReturn The pointer to the path to modify.
-
- @retval FALSE No directory was found to chop off.
- @retval TRUE A directory was chopped off.
-**/
-BOOLEAN
-EFIAPI
-ChopLastSlash(
- IN OUT CHAR16 *PathToReturn
- );
-
-/**
- Function to clean up paths. Removes the following items:
- single periods in the path (no need for the current directory tag)
- double periods in the path and removes a single parent directory.
-
- This will be done inline and the resultant string may be be 'too big'.
-
- @param[in] PathToReturn The pointer to the string containing the path.
-
- @return PathToReturn is always returned.
-**/
-CHAR16*
-EFIAPI
-CleanPath(
- IN CHAR16 *PathToReturn
- );
-
#endif //_SHELL_COMMAND_LIB_
|