]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/CCode/Source/FwImage/fwimage.c
Added or modified utility version and usage display.
[mirror_edk2.git] / Tools / CCode / Source / FwImage / fwimage.c
index 92bfd16a6fd2dd5a5bce069c9ff79f183831d1af..0f231488a3482ddffeaa68200ae4dc96840a5297 100644 (file)
@@ -35,7 +35,12 @@ Abstract:
 #include "CommonLib.h"\r
 #include "EfiUtilityMsgs.c"\r
 \r
-#define UTILITY_NAME  "FwImage"\r
+//\r
+// Version of this utility\r
+//\r
+#define UTILITY_NAME "FwImage"\r
+#define UTILITY_MAJOR_VERSION 1\r
+#define UTILITY_MINOR_VERSION 0\r
 \r
 #ifdef __GNUC__\r
 typedef unsigned long ULONG;\r
@@ -44,12 +49,27 @@ typedef unsigned char *PUCHAR;
 typedef unsigned short USHORT;\r
 #endif\r
 \r
+static\r
+void\r
+Version (\r
+  VOID\r
+  )\r
+{\r
+  printf ("%s v%d.%d -EDK Utility for Converting a pe32+ image to an FW image type.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);\r
+  printf ("Copyright (c) 1999-2006 Intel Corporation. All rights reserved.\n");\r
+}\r
+\r
+\r
 VOID\r
 Usage (\r
   VOID\r
   )\r
 {\r
-  printf ("Usage: " UTILITY_NAME "  {-t time-date} [BASE|SEC|PEI_CORE|PEIM|DXE_CORE|DXE_DRIVER|DXE_RUNTIME_DRIVER|DXE_SAL_DRIVER|DXE_SMM_DRIVER|TOOL|UEFI_DRIVER|UEFI_APPLICATION|USER_DEFINED] peimage [outimage]");\r
+  Version();\r
+  printf ("\nUsage: " UTILITY_NAME "  {-t time-date} {-h|--help|-?|/?|-V|--version} \n\\r
+         [BASE|SEC|PEI_CORE|PEIM|DXE_CORE|DXE_DRIVER|DXE_RUNTIME_DRIVER|\n\\r
+         DXE_SAL_DRIVER|DXE_SMM_DRIVER|TOOL|UEFI_DRIVER|UEFI_APPLICATION|\n\\r
+         USER_DEFINED] peimage [outimage]");\r
 }\r
 \r
 static\r
@@ -185,6 +205,22 @@ Returns:
   TimeStamp         = 0;\r
   TimeStampPresent  = FALSE;\r
 \r
+  if (argc < 1) {\r
+    Usage();\r
+    return STATUS_ERROR;\r
+  }\r
+  \r
+  if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0) ||\r
+      (strcmp(argv[1], "-?") == 0) || (strcmp(argv[1], "/?") == 0)) {\r
+    Usage();\r
+    return STATUS_ERROR;\r
+  }\r
+  \r
+  if ((strcmp(argv[1], "-V") == 0) || (strcmp(argv[1], "--version") == 0)) {\r
+    Version();\r
+    return STATUS_ERROR;\r
+  }\r
\r
   //\r
   // Look for -t time-date option first. If the time is "0", then\r
   // skip it.\r