]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/CCode/Source/GenAcpiTable/GenAcpiTable.c
Added or modified utility version and usage display.
[mirror_edk2.git] / Tools / CCode / Source / GenAcpiTable / GenAcpiTable.c
index f1efa3c302843363d4a1fc234a4764421cd3591b..457ac65fef0fa7403d1767fb2d8d59014ef2625a 100644 (file)
@@ -32,8 +32,9 @@ Abstract:
 //\r
 // Version of this utility\r
 //\r
-#define UTILITY_NAME    "GenAcpiTable"\r
-#define UTILITY_VERSION "v0.11"\r
+#define UTILITY_NAME  "GenAcpiTable"\r
+#define UTILITY_MAJOR_VERSION 0\r
+#define UTILITY_MINOR_VERSION 11\r
 \r
 //\r
 // Define the max length of a filename\r
@@ -81,6 +82,12 @@ static STRING_LOOKUP  mSubsystemTypes[] = {
 //\r
 //  Function prototypes\r
 //\r
+static\r
+void\r
+Version (\r
+  VOID\r
+  );\r
+\r
 static\r
 void\r
 Usage (\r
@@ -489,6 +496,22 @@ Returns:
   Argc--;\r
   Argv++;\r
 \r
+  if (Argc < 1) {\r
+    Usage();\r
+    return STATUS_ERROR;\r
+  }\r
+  \r
+  if ((strcmp(Argv[0], "-h") == 0) || (strcmp(Argv[0], "--help") == 0) ||\r
+      (strcmp(Argv[0], "-?") == 0) || (strcmp(Argv[0], "/?") == 0)) {\r
+    Usage();\r
+    return STATUS_ERROR;\r
+  }\r
+  \r
+  if ((strcmp(Argv[0], "-V") == 0) || (strcmp(Argv[0], "--version") == 0)) {\r
+    Version();\r
+    return STATUS_ERROR;\r
+  }\r
+\r
   if (Argc != 2) {\r
     Usage ();\r
     return STATUS_ERROR;\r
@@ -506,6 +529,17 @@ Returns:
   return STATUS_SUCCESS;\r
 }\r
 \r
+static\r
+void\r
+Version (\r
+  VOID\r
+  )\r
+{\r
+  printf ("%s v%d.%d -EDK Utility for generating ACPI Table image from an EFI PE32 image.\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
 static\r
 void\r
 Usage (\r
@@ -529,15 +563,14 @@ Returns:
 {\r
   int               Index;\r
   static const char *Msg[] = {\r
-    UTILITY_NAME " version "UTILITY_VERSION " - Generate ACPI Table image utility",\r
-    "  Generate an ACPI Table image from an EFI PE32 image",\r
-    "  Usage: "UTILITY_NAME " InFileName OutFileName",\r
-    "    where:",\r
-    "      InFileName     - name of the input PE32 file",\r
-    "      OutFileName    - to write output to OutFileName rather than InFileName"DEFAULT_OUTPUT_EXTENSION,\r
-    "",\r
+    "\nUsage: "UTILITY_NAME " {-h|--help|-?|/?|-V|--version} InFileName OutFileName",\r
+    "  where:",\r
+    "    InFileName  - name of the input PE32 file",\r
+    "    OutFileName - to write output to OutFileName rather than InFileName"DEFAULT_OUTPUT_EXTENSION,\r
     NULL\r
   };\r
+  \r
+  Version();\r
   for (Index = 0; Msg[Index] != NULL; Index++) {\r
     fprintf (stdout, "%s\n", Msg[Index]);\r
   }\r