Revision: 14975
http://sourceforge.net/p/edk2/code/14975
Author: jcarsey
Date: 2013-12-13 00:13:59 +0000 (Fri, 13 Dec 2013)
Log Message:
-----------
ShellPkg: add API for determining operation type
There are no callers for this new API yet. They will be added in the next
commits.
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
trunk/edk2/ShellPkg/Application/Shell/Shell.h
Modified: trunk/edk2/ShellPkg/Application/Shell/Shell.c
===================================================================
--- trunk/edk2/ShellPkg/Application/Shell/Shell.c 2013-12-12 21:44:23 UTC
(rev 14974)
+++ trunk/edk2/ShellPkg/Application/Shell/Shell.c 2013-12-13 00:13:59 UTC
(rev 14975)
@@ -1528,6 +1528,67 @@
}
/**
+ Takes the Argv[0] part of the command line and determine the meaning of it.
+**/
+SHELL_OPERATION_TYPES
+EFIAPI
+GetOperationType(
+ IN CONST CHAR16 *CmdName
+ )
+{
+ CHAR16* FileWithPath;
+ CONST CHAR16* TempLocation;
+ CONST CHAR16* TempLocation2;
+
+ FileWithPath = NULL;
+ //
+ // test for an internal command.
+ //
+ if (ShellCommandIsCommandOnList(CmdName)) {
+ return (INTERNAL_COMMAND);
+ }
+
+ //
+ // Test for file system change request. anything ending with : and cant
have spaces.
+ //
+ if (CmdName[(StrLen(CmdName)-1)] == L':') {
+ if (StrStr(CmdName, L" ") != NULL) {
+ return (UNKNOWN_INVALID);
+ }
+ return (FILE_SYS_CHANGE);
+ }
+
+ //
+ // Test for a file
+ //
+ if ((FileWithPath = ShellFindFilePathEx(CmdName, mExecutableExtensions)) !=
NULL) {
+ //
+ // See if that file has a script file extension
+ //
+ if (StrLen(FileWithPath) > 4) {
+ TempLocation = FileWithPath+StrLen(FileWithPath)-4;
+ TempLocation2 = mScriptExtension;
+ if (StringNoCaseCompare((VOID*)(&TempLocation), (VOID*)(&TempLocation2))
== 0) {
+ SHELL_FREE_NON_NULL(FileWithPath);
+ return (SCRIPT_FILE_NAME);
+ }
+ }
+
+ //
+ // Was a file, but not a script. we treat this as an application.
+ //
+ SHELL_FREE_NON_NULL(FileWithPath);
+ return (EFI_APPLICATION);
+ }
+
+ SHELL_FREE_NON_NULL(FileWithPath);
+ //
+ // No clue what this is... return invalid flag...
+ //
+ return (UNKNOWN_INVALID);
+}
+
+/**
Function will process and run a command line.
This will determine if the command line represents an internal shell
Modified: trunk/edk2/ShellPkg/Application/Shell/Shell.h
===================================================================
--- trunk/edk2/ShellPkg/Application/Shell/Shell.h 2013-12-12 21:44:23 UTC
(rev 14974)
+++ trunk/edk2/ShellPkg/Application/Shell/Shell.h 2013-12-13 00:13:59 UTC
(rev 14975)
@@ -124,6 +124,14 @@
extern SHELL_INFO ShellInfoObject;
+typedef enum {
+ INTERNAL_COMMAND,
+ SCRIPT_FILE_NAME,
+ EFI_APPLICATION,
+ FILE_SYS_CHANGE,
+ UNKNOWN_INVALID
+} SHELL_OPERATION_TYPES;
+
/**
Sets all the alias' that were registered with the ShellCommandLib library.
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