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/Library/UefiShellCommandLib | |
parent | f1518f69703e1086f346a6e9d8e5a59855954178 (diff) | |
download | edk2-platforms-ab94587a7d2cd89695f9190420daceae0d2b7446.tar.xz |
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/Library/UefiShellCommandLib')
-rw-r--r-- | ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c | 106 |
1 files changed, 0 insertions, 106 deletions
diff --git a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c index 82a9e78ed5..28b7dda51e 100644 --- a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c +++ b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c @@ -1123,30 +1123,6 @@ ShellCommandCreateInitialMappingsAndPaths( }
/**
- Function to make sure all directory delimeters are backslashes.
-
- @param[in,out] Path The path to modify.
-
- @return Path.
-**/
-CHAR16*
-EFIAPI
-ShellCommandCleanPath (
- IN OUT CHAR16 *Path
- )
-{
- CHAR16 *Path2;
-
- for (Path2 = Path ; Path2 != NULL && *Path2 != CHAR_NULL ; Path2++) {
- if (*Path2 == L'/') {
- *Path2 = L'\\';
- }
- }
-
- return (Path);
-}
-
-/**
Converts a SHELL_FILE_HANDLE to an EFI_FILE_PROTOCOL*.
@param[in] Handle The SHELL_FILE_HANDLE to convert.
@@ -1489,85 +1465,3 @@ FreeBufferList ( }
}
-/**
- Chops off last directory or file entry in a path leaving the trailing slash
-
- @param[in,out] PathToReturn 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
- )
-{
- CHAR16 *Walker;
- CHAR16 *LastSlash;
- //
- // get directory name from path... ('chop' off extra)
- //
- for ( Walker = PathToReturn, LastSlash = NULL
- ; Walker != NULL && *Walker != CHAR_NULL
- ; Walker++
- ){
- if (*Walker == L'\\' && *(Walker + 1) != CHAR_NULL) {
- LastSlash = Walker+1;
- }
- }
- if (LastSlash != NULL) {
- *LastSlash = CHAR_NULL;
- return (TRUE);
- }
- return (FALSE);
-}
-
-/**
- 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
- )
-{
- CHAR16 *TempString;
- UINTN TempSize;
- if (PathToReturn==NULL) {
- return(NULL);
- }
- //
- // Fix up the directory name
- //
- while ((TempString = StrStr(PathToReturn, L"\\..\\")) != NULL) {
- *TempString = CHAR_NULL;
- TempString += 4;
- ChopLastSlash(PathToReturn);
- TempSize = StrSize(TempString);
- CopyMem(PathToReturn+StrLen(PathToReturn), TempString, TempSize);
- }
- if ((TempString = StrStr(PathToReturn, L"\\..")) != NULL && *(TempString + 3) == CHAR_NULL) {
- *TempString = CHAR_NULL;
- ChopLastSlash(PathToReturn);
- }
- while ((TempString = StrStr(PathToReturn, L"\\.\\")) != NULL) {
- *TempString = CHAR_NULL;
- TempString += 2;
- TempSize = StrSize(TempString);
- CopyMem(PathToReturn+StrLen(PathToReturn), TempString, TempSize);
- }
- if ((TempString = StrStr(PathToReturn, L"\\.")) != NULL && *(TempString + 2) == CHAR_NULL) {
- *TempString = CHAR_NULL;
- }
- return (PathToReturn);
-}
-
|