]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.c
ShellPkg: Update Guid usage in ShellLib INF to match source code logic
[mirror_edk2.git] / ShellPkg / Library / UefiShellCEntryLib / UefiShellCEntryLib.c
index 53e50ca7dead2f11018ed6b4f0a96b1343c75bf2..61b3ec97e2be373f2b2d9e8d520ceda7214153a8 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
-  Provides application point extension for "C" style main funciton\r
+  Provides application point extension for "C" style main function\r
 \r
-  Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -17,7 +17,7 @@
 #include <Protocol/SimpleFileSystem.h>\r
 #include <Protocol/LoadedImage.h>\r
 #include <Protocol/EfiShellInterface.h>\r
-#include <Protocol/EfiShellParameters.h>\r
+#include <Protocol/ShellParameters.h>\r
 \r
 #include <Library/ShellCEntryLib.h>\r
 #include <Library/DebugLib.h>\r
   An application that uses UefiShellCEntryLib must have a ShellAppMain\r
   function as prototyped in Include/Library/ShellCEntryLib.h.\r
 \r
+  Note that the Shell uses POSITIVE integers for error values, while UEFI\r
+  uses NEGATIVE values.  If the application is to be used within a script,\r
+  it needs to return one of the SHELL_STATUS values defined in Protocol/Shell.h.\r
+\r
   @param  ImageHandle  The image handle of the UEFI Application.\r
   @param  SystemTable  A pointer to the EFI System Table.\r
 \r
@@ -59,7 +63,7 @@ ShellCEntryLib (
                              ImageHandle,\r
                              NULL,\r
                              EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
-                             );\r
+                            );\r
   if (!EFI_ERROR(Status)) {\r
     //\r
     // use shell 2.0 interface\r
@@ -67,7 +71,7 @@ ShellCEntryLib (
     ReturnFromMain = ShellAppMain (\r
                        EfiShellParametersProtocol->Argc,\r
                        EfiShellParametersProtocol->Argv\r
-                       );\r
+                      );\r
   } else {\r
     //\r
     // try to get shell 1.0 interface instead.\r
@@ -78,7 +82,7 @@ ShellCEntryLib (
                                ImageHandle,\r
                                NULL,\r
                                EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
-                               );\r
+                              );\r
     if (!EFI_ERROR(Status)) {\r
       //\r
       // use shell 1.0 interface\r
@@ -86,14 +90,10 @@ ShellCEntryLib (
       ReturnFromMain = ShellAppMain (\r
                          EfiShellInterface->Argc,\r
                          EfiShellInterface->Argv\r
-                         );\r
+                        );\r
     } else {\r
       ASSERT(FALSE);\r
     }\r
   }\r
-  if (ReturnFromMain == 0) {\r
-    return (EFI_SUCCESS);\r
-  } else {\r
-    return (EFI_UNSUPPORTED);\r
-  }\r
+  return ReturnFromMain;\r
 }\r