diff options
author | jcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-04-13 23:35:59 +0000 |
---|---|---|
committer | jcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-04-13 23:35:59 +0000 |
commit | a49016b117dceddc8b44fe3e5e4e3623cee133e5 (patch) | |
tree | 76420a01b6f8f9b066c1a36ce190720d2b6a9de8 /ShellPkg | |
parent | 10ad7974feee38e314e1ca07bc69d29813c4f4d1 (diff) | |
download | edk2-a49016b117dceddc8b44fe3e5e4e3623cee133e5.zip edk2-a49016b117dceddc8b44fe3e5e4e3623cee133e5.tar.gz edk2-a49016b117dceddc8b44fe3e5e4e3623cee133e5.tar.bz2 |
move a function to the correct library.
added "ren" as an alias for "mv"
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11537 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ShellPkg')
-rw-r--r-- | ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c | 48 | ||||
-rw-r--r-- | ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.c | 49 |
2 files changed, 49 insertions, 48 deletions
diff --git a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c index 9e7cd0e..b91ba27 100644 --- a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c +++ b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c @@ -1545,3 +1545,51 @@ ChopLastSlash( 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);
+}
+
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.c index 11a15b5..e54d5f3 100644 --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.c +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.c @@ -111,6 +111,7 @@ ShellLevel2CommandsLibConstructor ( ShellCommandRegisterAlias(L"mkdir", L"md");
ShellCommandRegisterAlias(L"cd ..", L"cd..");
ShellCommandRegisterAlias(L"cd \\", L"cd\\");
+ ShellCommandRegisterAlias(L"ren", L"mv");
//
// These are installed in level 2 or 3...
//
@@ -154,54 +155,6 @@ ShellLevel2CommandsLibDestructor ( }
/**
- 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);
-}
-
-/**
returns a fully qualified directory (contains a map drive at the begining)
path from a unknown directory path.
|