]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/CCode/Source/GenFvImage/GenFvImageExe.c
Minor changes and bug fixes implemented.
[mirror_edk2.git] / Tools / CCode / Source / GenFvImage / GenFvImageExe.c
index f5a5179559dba5af32c71448ad335559c2e3aedb..294c303085828cf97e5e0ef1decc7400f8b0b7d1 100644 (file)
@@ -1,6 +1,6 @@
 /*++\r
 \r
-Copyright (c) 2004, Intel Corporation                                                         \r
+Copyright (c) 2004-2007, Intel Corporation                                                         \r
 All rights reserved. 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
@@ -29,10 +29,11 @@ Abstract:
 #include "CommonLib.h"\r
 #include "EfiUtilityMsgs.h"\r
 \r
-VOID\r
-PrintUtilityInfo (\r
-  VOID\r
-  )\r
+static\r
+void \r
+Version(\r
+  void\r
+)\r
 /*++\r
 \r
 Routine Description:\r
@@ -49,17 +50,15 @@ Returns:
 \r
 --*/\r
 {\r
-  printf (\r
-    "%s - Tiano Firmware Volume Generation Utility."" Version %i.%i\n\n",\r
-    UTILITY_NAME,\r
-    UTILITY_MAJOR_VERSION,\r
-    UTILITY_MINOR_VERSION\r
-    );\r
+  printf ("%s v%d.%d -Tiano Firmware Volume Generation Utility.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);\r
+  printf ("Copyright (c) 1999-2007 Intel Corporation. All rights reserved.\n");\r
 }\r
\r
 \r
-VOID\r
-PrintUsage (\r
-  VOID\r
+static\r
+void \r
+Usage(\r
+  void\r
   )\r
 /*++\r
 \r
@@ -77,9 +76,11 @@ Returns:
 \r
 --*/\r
 {\r
-  printf ("Usage: %s -I FvInfFileName\n", UTILITY_NAME);\r
+  Version();\r
+  \r
+  printf ("\nUsage: %s -I FvInfFileName\n", UTILITY_NAME);\r
   printf ("  Where:\n");\r
-  printf ("\tFvInfFileName is the name of the image description file.\n\n");\r
+  printf ("    FvInfFileName is the name of the image description file.\n\n");\r
 }\r
 \r
 int\r
@@ -133,17 +134,29 @@ Returns:
   SymFileName = SymFileNameBuffer;\r
 \r
   SetUtilityName (UTILITY_NAME);\r
-  //\r
-  // Display utility information\r
-  //\r
-  PrintUtilityInfo ();\r
-\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 GetUtilityStatus ();\r
+  }\r
+  \r
+  if ((strcmp(argv[1], "-V") == 0) || (strcmp(argv[1], "--version") == 0)) {\r
+    Version();\r
+    return GetUtilityStatus ();\r
+  }\r
+  \r
   //\r
   // Verify the correct number of arguments\r
   //\r
   if (argc != MAX_ARGS) {\r
     Error (NULL, 0, 0, "invalid number of input parameters specified", NULL);\r
-    PrintUsage ();\r
+    Usage ();\r
     return GetUtilityStatus ();\r
   }\r
   //\r
@@ -160,7 +173,7 @@ Returns:
     //\r
     if (argv[Index][0] != '-' && argv[Index][0] != '/') {\r
       Error (NULL, 0, 0, argv[Index], "argument pair must begin with \"-\" or \"/\"");\r
-      PrintUsage ();\r
+      Usage ();\r
       return GetUtilityStatus ();\r
     }\r
     //\r
@@ -168,7 +181,7 @@ Returns:
     //\r
     if (argv[Index][2] != 0) {\r
       Error (NULL, 0, 0, argv[Index], "unrecognized argument");\r
-      PrintUsage ();\r
+      Usage ();\r
       return GetUtilityStatus ();\r
     }\r
     //\r
@@ -182,14 +195,14 @@ Returns:
         strcpy (InfFileName, argv[Index + 1]);\r
       } else {\r
         Error (NULL, 0, 0, argv[Index + 1], "FvInfFileName may only be specified once");\r
-        PrintUsage ();\r
+        Usage ();\r
         return GetUtilityStatus ();\r
       }\r
       break;\r
 \r
     default:\r
       Error (NULL, 0, 0, argv[Index], "unrecognized argument");\r
-      PrintUsage ();\r
+      Usage ();\r
       return GetUtilityStatus ();\r
       break;\r
     }\r