Revision: 14983
http://sourceforge.net/p/edk2/code/14983
Author: jcarsey
Date: 2013-12-13 18:45:43 +0000 (Fri, 13 Dec 2013)
Log Message:
-----------
ShellPkg: Refactor change to current file system
This moves the initialization for handling file system changes into a separate
function.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey <[email protected]>
Reviewed-by: Erik Bjorge <[email protected]>
Modified Paths:
--------------
trunk/edk2/ShellPkg/Application/Shell/Shell.c
Modified: trunk/edk2/ShellPkg/Application/Shell/Shell.c
===================================================================
--- trunk/edk2/ShellPkg/Application/Shell/Shell.c 2013-12-13 18:18:27 UTC
(rev 14982)
+++ trunk/edk2/ShellPkg/Application/Shell/Shell.c 2013-12-13 18:45:43 UTC
(rev 14983)
@@ -1618,7 +1618,44 @@
}
return (Status);
}
+
/**
+ Handle a request to change the current file system
+
+ @param[in] CmdLine The passed in command line
+
+ @retval EFI_SUCCESS The operation was successful
+**/
+EFI_STATUS
+EFIAPI
+ChangeMappedDrive(
+ IN CONST CHAR16 *CmdLine
+ )
+{
+ EFI_STATUS Status;
+ Status = EFI_SUCCESS;
+
+ //
+ // make sure we are the right operation
+ //
+ ASSERT(CmdLine[(StrLen(CmdLine)-1)] == L':' && StrStr(CmdLine, L" ") ==
NULL);
+
+ //
+ // Call the protocol API to do the work
+ //
+ Status = ShellInfoObject.NewEfiShellProtocol->SetCurDir(NULL, CmdLine);
+
+ //
+ // Report any errors
+ //
+ if (EFI_ERROR(Status)) {
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_INVALID_MAPPING),
ShellInfoObject.HiiHandle, CmdLine);
+ }
+
+ return (Status);
+}
+
+/**
Function will process and run a command line.
This will determine if the command line represents an internal shell
@@ -1702,19 +1739,16 @@
if (ContainsSplit(CleanOriginal)) {
Status = ProcessNewSplitCommandLine(CleanOriginal);
} else {
-
//
// If this is a mapped drive change handle that...
//
if (CleanOriginal[(StrLen(CleanOriginal)-1)] == L':' &&
StrStr(CleanOriginal, L" ") == NULL) {
- Status = ShellInfoObject.NewEfiShellProtocol->SetCurDir(NULL,
CleanOriginal);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN
(STR_SHELL_INVALID_MAPPING), ShellInfoObject.HiiHandle, CleanOriginal);
- }
- FreePool(CleanOriginal);
+ Status = ChangeMappedDrive(CleanOriginal);
+ SHELL_FREE_NON_NULL(CleanOriginal);
return (Status);
}
+
///@todo update this section to divide into 3 ways - run internal command,
run split (above), and run an external file...
/// We waste a lot of time doing processing like
StdIn,StdOut,Argv,Argc for things that are external files...
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits