]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
This refactors 3 functions out of ShellCommandLib and puts them into a new library...
[mirror_edk2.git] / ShellPkg / Library / UefiShellCommandLib / UefiShellCommandLib.c
index 82a9e78ed58024bf00bfe4e03ab003af5ad24b09..28b7dda51e8b1a6560c300340469a5ab390ca335 100644 (file)
@@ -1122,30 +1122,6 @@ ShellCommandCreateInitialMappingsAndPaths(
   return (EFI_SUCCESS);\r
 }\r
 \r
-/**\r
-  Function to make sure all directory delimeters are backslashes.\r
-\r
-  @param[in,out] Path     The path to modify.\r
-\r
-  @return Path.\r
-**/\r
-CHAR16*\r
-EFIAPI\r
-ShellCommandCleanPath (\r
-  IN OUT CHAR16 *Path\r
-  )\r
-{\r
-  CHAR16  *Path2;\r
-\r
-  for (Path2 = Path ; Path2 != NULL && *Path2 != CHAR_NULL ; Path2++) {\r
-    if (*Path2 == L'/') {\r
-      *Path2 = L'\\';\r
-    }\r
-  }\r
-\r
-  return (Path);\r
-}\r
-\r
 /**\r
   Converts a SHELL_FILE_HANDLE to an EFI_FILE_PROTOCOL*.\r
 \r
@@ -1489,85 +1465,3 @@ FreeBufferList (
   }\r
 }\r
 \r
-/**\r
-  Chops off last directory or file entry in a path leaving the trailing slash\r
-\r
-  @param[in,out] PathToReturn The path to modify.\r
-\r
-  @retval FALSE     No directory was found to chop off.\r
-  @retval TRUE      A directory was chopped off.\r
-**/\r
-BOOLEAN\r
-EFIAPI\r
-ChopLastSlash(\r
-  IN OUT CHAR16 *PathToReturn\r
-  )\r
-{\r
-  CHAR16        *Walker;\r
-  CHAR16        *LastSlash;\r
-  //\r
-  // get directory name from path... ('chop' off extra)\r
-  //\r
-  for ( Walker = PathToReturn, LastSlash = NULL\r
-      ; Walker != NULL && *Walker != CHAR_NULL\r
-      ; Walker++\r
-     ){\r
-    if (*Walker == L'\\' && *(Walker + 1) != CHAR_NULL) {\r
-      LastSlash = Walker+1;\r
-    }\r
-  }\r
-  if (LastSlash != NULL) {\r
-    *LastSlash = CHAR_NULL;\r
-    return (TRUE);\r
-  }\r
-  return (FALSE);\r
-}\r
-\r
-/**\r
-  Function to clean up paths.  Removes the following items:\r
-    single periods in the path (no need for the current directory tag)\r
-    double periods in the path and removes a single parent directory.\r
-\r
-  This will be done inline and the resultant string may be be 'too big'.\r
-\r
-  @param[in] PathToReturn  The pointer to the string containing the path.\r
-\r
-  @return PathToReturn is always returned.\r
-**/\r
-CHAR16*\r
-EFIAPI\r
-CleanPath(\r
-  IN CHAR16 *PathToReturn\r
-  )\r
-{\r
-  CHAR16  *TempString;\r
-  UINTN   TempSize;\r
-  if (PathToReturn==NULL) {\r
-    return(NULL);\r
-  }\r
-  //\r
-  // Fix up the directory name\r
-  //\r
-  while ((TempString = StrStr(PathToReturn, L"\\..\\")) != NULL) {\r
-    *TempString = CHAR_NULL;\r
-    TempString  += 4;\r
-    ChopLastSlash(PathToReturn);\r
-    TempSize = StrSize(TempString);\r
-    CopyMem(PathToReturn+StrLen(PathToReturn), TempString, TempSize);\r
-  }\r
-  if ((TempString = StrStr(PathToReturn, L"\\..")) != NULL && *(TempString + 3) == CHAR_NULL) {\r
-    *TempString = CHAR_NULL;\r
-    ChopLastSlash(PathToReturn);\r
-  }\r
-  while ((TempString = StrStr(PathToReturn, L"\\.\\")) != NULL) {\r
-    *TempString = CHAR_NULL;\r
-    TempString  += 2;\r
-    TempSize = StrSize(TempString);\r
-    CopyMem(PathToReturn+StrLen(PathToReturn), TempString, TempSize);\r
-  }\r
-  if ((TempString = StrStr(PathToReturn, L"\\.")) != NULL && *(TempString + 2) == CHAR_NULL) {\r
-    *TempString = CHAR_NULL;\r
-  }\r
-  return (PathToReturn);\r
-}\r
-\r