]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Minor changes and bug fixes implemented.
authorywang <ywang@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 8 Jan 2007 22:27:20 +0000 (22:27 +0000)
committerywang <ywang@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 8 Jan 2007 22:27:20 +0000 (22:27 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2196 6f19259b-4bc3-4df7-8a09-765794883524

13 files changed:
Tools/CCode/Source/EfiCompress/EfiCompressMain.c
Tools/CCode/Source/FwImage/fwimage.c
Tools/CCode/Source/GenBsfFixup/GenBsfFixup.c
Tools/CCode/Source/GenBsfImage/GenBsfImage.c
Tools/CCode/Source/GenCRC32Section/GenCRC32Section.c
Tools/CCode/Source/GenCapsuleHdr/GenCapsuleHdr.c
Tools/CCode/Source/GenDepex/GenDepex.c
Tools/CCode/Source/GenFfsFile/GenFfsFile.c
Tools/CCode/Source/GenFvImage/GenFvImageExe.c
Tools/CCode/Source/GenSection/GenSection.c
Tools/CCode/Source/GenTEImage/GenTEImage.c
Tools/CCode/Source/ModifyInf/ModifyInf.c
Tools/CCode/Source/Strip/Strip.c

index 360b7355cb2a87e5d553e21d4f6464ee470d35bd..b7ff7c733ee315861c5cb7c960c40a7ccd2b623a 100644 (file)
@@ -121,7 +121,7 @@ Returns:
   SrcBuffer             = DstBuffer = NULL;\r
   infile                = outfile = NULL;\r
 \r
   SrcBuffer             = DstBuffer = NULL;\r
   infile                = outfile = NULL;\r
 \r
-  if (argc < 1) {\r
+  if (argc == 1) {\r
     Usage();\r
     goto Done;\r
   }\r
     Usage();\r
     goto Done;\r
   }\r
index fb3f1a7ecdb593d12f3a54282ad665336d46b2c1..beddd8ee08557b47d415dc2500159dbc9506ecb8 100644 (file)
@@ -762,7 +762,7 @@ Returns:
   TimeStamp         = 0;\r
   TimeStampPresent  = FALSE;\r
 \r
   TimeStamp         = 0;\r
   TimeStampPresent  = FALSE;\r
 \r
-  if (argc < 1) {\r
+  if (argc == 1) {\r
     Usage();\r
     return STATUS_ERROR;\r
   }\r
     Usage();\r
     return STATUS_ERROR;\r
   }\r
index 1cc1e83389e13203276b1b209d8a9e4bed004aa0..6082b4d838cc0dc10ffe3868553d9e40ec90f072 100644 (file)
@@ -394,7 +394,7 @@ Returns:
   Index   = 0;\r
   Invert  = 0;\r
  \r
   Index   = 0;\r
   Invert  = 0;\r
  \r
-  if (argc < 1) {\r
+  if (argc == 1) {\r
     Usage();\r
     return -1;\r
   }\r
     Usage();\r
     return -1;\r
   }\r
index bc3ae9f2447eafb95208d9f9532e5b4a2b04b5c4..a294a2eea3f25579b28df5231f749dfe2e0ed275 100644 (file)
@@ -2559,7 +2559,7 @@ Returns:
   //\r
   // Verify the correct number of arguments\r
   //\r
   //\r
   // Verify the correct number of arguments\r
   //\r
-  if (argc < 1) {\r
+  if (argc == 1) {\r
     Usage();\r
     return 1;\r
   }\r
     Usage();\r
     return 1;\r
   }\r
index 5c9af78181c5b0ac1401cc40f6b5163894515250..678275a367bb295de0e6b71ed461af7f96050457 100644 (file)
@@ -239,6 +239,11 @@ main (
   OutputFileName  = NULL;\r
 \r
   SetUtilityName (UTILITY_NAME);\r
   OutputFileName  = NULL;\r
 \r
   SetUtilityName (UTILITY_NAME);\r
+  \r
+  if (argc == 1) {\r
+    Usage ();\r
+    return -1;\r
+  }\r
 \r
   if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0) ||\r
       (strcmp(argv[1], "-?") == 0) || (strcmp(argv[1], "/?") == 0)) {\r
 \r
   if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0) ||\r
       (strcmp(argv[1], "-?") == 0) || (strcmp(argv[1], "/?") == 0)) {\r
@@ -250,11 +255,6 @@ main (
     Version();\r
     return -1;\r
   }\r
     Version();\r
     return -1;\r
   }\r
-  \r
-  if (argc == 1) {\r
-    Usage ();\r
-    return -1;\r
-  }\r
 \r
   BufferSize  = 1024 * 1024 * 16;\r
   FileBuffer  = (UINT8 *) malloc (BufferSize * sizeof (UINT8));\r
 \r
   BufferSize  = 1024 * 1024 * 16;\r
   FileBuffer  = (UINT8 *) malloc (BufferSize * sizeof (UINT8));\r
index 97482f2cebcd0cd140b1a2ed356e408ea1734960..16b15c3d66969be6c5627b910e48c2a99edeae4b 100644 (file)
@@ -2379,6 +2379,11 @@ Returns:
     Version();\r
     return STATUS_ERROR;\r
   }\r
     Version();\r
     return STATUS_ERROR;\r
   }\r
+  \r
+  if (Argc == 1) {\r
+    Usage ();\r
+    return STATUS_ERROR;\r
+  }\r
  \r
   //\r
   // Process until no more options\r
  \r
   //\r
   // Process until no more options\r
index e28be72acc3df18deb7832fd176e0a85288ecad8..5c27797a9be9aa3fd2265eedc52148a829c4ab30 100644 (file)
@@ -106,7 +106,7 @@ Returns:
 --*/\r
 {\r
   printf (\r
 --*/\r
 {\r
   printf (\r
-    "%s, Tiano Dependency Expression Generation Utility. Version %d.%d.\n",\r
+    "%s v%d.%d -Tiano utility to generate dependency expression.\n",\r
     UTILITY_NAME,\r
     UTILITY_MAJOR_VERSION,\r
     UTILITY_MINOR_VERSION\r
     UTILITY_NAME,\r
     UTILITY_MAJOR_VERSION,\r
     UTILITY_MINOR_VERSION\r
@@ -855,16 +855,22 @@ Returns:
   Output_Flag = FALSE;\r
   Pad_Flag    = FALSE;\r
 \r
   Output_Flag = FALSE;\r
   Pad_Flag    = FALSE;\r
 \r
-  //\r
-  //  Output the calling arguments\r
-  //\r
-  printf ("\n\n");\r
-  for (Index = 0; Index < argc; Index++) {\r
-    printf ("%s ", argv[Index]);\r
+  if (argc == 1) {\r
+    Usage();\r
+    return EFI_INVALID_PARAMETER;\r
   }\r
   }\r
-\r
-  printf ("\n\n");\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 EFI_INVALID_PARAMETER;\r
+  }\r
+  \r
+  if ((strcmp(argv[1], "-V") == 0) || (strcmp(argv[1], "--version") == 0)) {\r
+    Version();\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
\r
   if (argc < 5) {\r
     printf ("Not enough arguments\n");\r
     Usage();\r
   if (argc < 5) {\r
     printf ("Not enough arguments\n");\r
     Usage();\r
index d4e54683439830cebd9ffdfe50c93d6a8959df0d..81708cfc8c1d20b49961b6a22975f2f2903ea1af 100644 (file)
@@ -1,6 +1,6 @@
 /*++\r
 \r
 /*++\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
 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
@@ -46,8 +46,10 @@ Abstract:
 #include "EfiUtilityMsgs.h"\r
 #include "SimpleFileParsing.h"\r
 \r
 #include "EfiUtilityMsgs.h"\r
 #include "SimpleFileParsing.h"\r
 \r
-#define UTILITY_NAME    "GenFfsFile"\r
-#define TOOLVERSION     "0.32"\r
+#define UTILITY_NAME            "GenFfsFile"\r
+#define UTILITY_MAJOR_VERSION   0\r
+#define UTILITY_MINOR_VERSION   32\r
+\r
 #define MAX_ARRAY_SIZE  100\r
 \r
 static\r
 #define MAX_ARRAY_SIZE  100\r
 \r
 static\r
@@ -83,7 +85,13 @@ ProcessCommandLineArgs (
 \r
 static\r
 void\r
 \r
 static\r
 void\r
-PrintUsage (\r
+Version (\r
+  void\r
+  );\r
+\r
+static\r
+void\r
+Usage (\r
   void\r
   );\r
 \r
   void\r
   );\r
 \r
@@ -134,9 +142,34 @@ Returns:
   String[Index - Index2] = 0;\r
 }\r
 \r
   String[Index - Index2] = 0;\r
 }\r
 \r
+static\r
+void \r
+Version(\r
+  void\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Print out version information for this utility.\r
+\r
+Arguments:\r
+\r
+  None\r
+  \r
+Returns:\r
+\r
+  None\r
+  \r
+--*/ \r
+{\r
+  printf ("%s v%d.%d -EDK utility to generate a Firmware File System files.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);\r
+  printf ("Copyright (c) 1999-2007 Intel Corporation. All rights reserved.\n");\r
+}\r
+\r
 static\r
 void\r
 static\r
 void\r
-PrintUsage (\r
+Usage (\r
   void\r
   )\r
 /*++\r
   void\r
   )\r
 /*++\r
@@ -155,7 +188,9 @@ Returns:
 \r
 --*/\r
 {\r
 \r
 --*/\r
 {\r
-  printf ("Usage:\n");\r
+  Version();\r
+  \r
+  printf ("\nUsage:\n");\r
   printf (UTILITY_NAME " -b \"build directory\" -p1 \"package1.inf\" -p2 \"package2.inf\" -v\n");\r
   printf ("   -b \"build directory\":\n ");\r
   printf ("       specifies the full path to the component build directory.\n");\r
   printf (UTILITY_NAME " -b \"build directory\" -p1 \"package1.inf\" -p2 \"package2.inf\" -v\n");\r
   printf ("   -b \"build directory\":\n ");\r
   printf ("       specifies the full path to the component build directory.\n");\r
@@ -2545,14 +2580,27 @@ Returns:
   //\r
   // If no args, then print usage instructions and return an error\r
   //\r
   //\r
   // If no args, then print usage instructions and return an error\r
   //\r
-  if (Argc == 1) {\r
-    PrintUsage ();\r
+  Argc--;\r
+  Argv++;\r
+  \r
+  if (Argc < 1) {\r
+    Usage ();\r
     return STATUS_ERROR;\r
   }\r
     return STATUS_ERROR;\r
   }\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
   memset (&mGlobals, 0, sizeof (mGlobals));\r
   memset (&mGlobals, 0, sizeof (mGlobals));\r
-  Argc--;\r
-  Argv++;\r
\r
   while (Argc > 0) {\r
     if (strcmpi (Argv[0], "-b") == 0) {\r
       //\r
   while (Argc > 0) {\r
     if (strcmpi (Argv[0], "-b") == 0) {\r
       //\r
@@ -2617,17 +2665,17 @@ Returns:
       //\r
       // OPTION: -h      help\r
       //\r
       //\r
       // OPTION: -h      help\r
       //\r
-      PrintUsage ();\r
+      Usage ();\r
       return STATUS_ERROR;\r
     } else if (strcmpi (Argv[0], "-?") == 0) {\r
       //\r
       // OPTION:  -?      help\r
       //\r
       return STATUS_ERROR;\r
     } else if (strcmpi (Argv[0], "-?") == 0) {\r
       //\r
       // OPTION:  -?      help\r
       //\r
-      PrintUsage ();\r
+      Usage ();\r
       return STATUS_ERROR;\r
     } else {\r
       Error (NULL, 0, 0, Argv[0], "unrecognized option");\r
       return STATUS_ERROR;\r
     } else {\r
       Error (NULL, 0, 0, Argv[0], "unrecognized option");\r
-      PrintUsage ();\r
+      Usage ();\r
       return STATUS_ERROR;\r
     }\r
 \r
       return STATUS_ERROR;\r
     }\r
 \r
index f5a5179559dba5af32c71448ad335559c2e3aedb..294c303085828cf97e5e0ef1decc7400f8b0b7d1 100644 (file)
@@ -1,6 +1,6 @@
 /*++\r
 \r
 /*++\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
 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
 #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
 /*++\r
 \r
 Routine Description:\r
@@ -49,17 +50,15 @@ Returns:
 \r
 --*/\r
 {\r
 \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
 \r
 \r
-VOID\r
-PrintUsage (\r
-  VOID\r
+static\r
+void \r
+Usage(\r
+  void\r
   )\r
 /*++\r
 \r
   )\r
 /*++\r
 \r
@@ -77,9 +76,11 @@ Returns:
 \r
 --*/\r
 {\r
 \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 ("  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
 }\r
 \r
 int\r
@@ -133,17 +134,29 @@ Returns:
   SymFileName = SymFileNameBuffer;\r
 \r
   SetUtilityName (UTILITY_NAME);\r
   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
   //\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
     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
     //\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
       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
     //\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
       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
         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
         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
       return GetUtilityStatus ();\r
       break;\r
     }\r
index 3209b1e3d02a6eb64fca32a382d51aabd769488a..e3f173f65602ef986d8d808a29dbe195edd40acd 100644 (file)
@@ -36,6 +36,9 @@ Abstract:
 \r
 \r
 #define UTILITY_NAME            "GenSection"\r
 \r
 \r
 #define UTILITY_NAME            "GenSection"\r
+#define UTILITY_MAJOR_VERSION   0\r
+#define UTILITY_MINOR_VERSION   1\r
+\r
 \r
 #define PARAMETER_NOT_SPECIFIED "Parameter not specified"\r
 #define MAXIMUM_INPUT_FILE_NUM  10\r
 \r
 #define PARAMETER_NOT_SPECIFIED "Parameter not specified"\r
 #define MAXIMUM_INPUT_FILE_NUM  10\r
@@ -75,16 +78,43 @@ char      *CompressionTypeName[]    = { "NONE", "STANDARD" };
 char      *GUIDedSectionTypeName[]  = { "CRC32" };\r
 EFI_GUID  gEfiCrc32SectionGuid      = EFI_CRC32_GUIDED_SECTION_EXTRACTION_PROTOCOL_GUID;\r
 \r
 char      *GUIDedSectionTypeName[]  = { "CRC32" };\r
 EFI_GUID  gEfiCrc32SectionGuid      = EFI_CRC32_GUIDED_SECTION_EXTRACTION_PROTOCOL_GUID;\r
 \r
+static\r
+void \r
+Version(\r
+  void\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Print out version information for this utility.\r
+\r
+Arguments:\r
+\r
+  None\r
+  \r
+Returns:\r
+\r
+  None\r
+  \r
+--*/ \r
+{\r
+  printf ("%s v%d.%d -Utility to create output file with formed section per the FV spec.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);\r
+  printf ("Copyright (c) 1999-2007 Intel Corporation. All rights reserved.\n");\r
+}\r
+\r
 static\r
 VOID\r
 static\r
 VOID\r
-PrintUsageMessage (\r
+Usage (\r
   VOID\r
   )\r
 {\r
   UINTN SectionType;\r
   UINTN DisplayCount;\r
 \r
   VOID\r
   )\r
 {\r
   UINTN SectionType;\r
   UINTN DisplayCount;\r
 \r
-  printf ("Usage: "UTILITY_NAME "  -i InputFile -o OutputFile -s SectionType [SectionType params]\n\n");\r
+  Version();\r
+  \r
+  printf ("\nUsage: "UTILITY_NAME "  -i InputFile -o OutputFile -s SectionType [SectionType params]\n\n");\r
   printf ("    Where SectionType is one of the following section types:\n\n");\r
 \r
   DisplayCount = 0;\r
   printf ("    Where SectionType is one of the following section types:\n\n");\r
 \r
   DisplayCount = 0;\r
@@ -659,10 +689,23 @@ Returns:
   Status                = EFI_SUCCESS;\r
 \r
   SetUtilityName (UTILITY_NAME);\r
   Status                = EFI_SUCCESS;\r
 \r
   SetUtilityName (UTILITY_NAME);\r
+  \r
   if (argc == 1) {\r
   if (argc == 1) {\r
-    PrintUsageMessage ();\r
+    Usage ();\r
     return STATUS_ERROR;\r
   }\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
   // Parse command line\r
   //\r
   //\r
   // Parse command line\r
   //\r
@@ -758,7 +801,7 @@ Returns:
       Index++;\r
       ParamDigitalSignature = argv[Index];\r
     } else if (strcmpi (argv[Index], "-?") == 0) {\r
       Index++;\r
       ParamDigitalSignature = argv[Index];\r
     } else if (strcmpi (argv[Index], "-?") == 0) {\r
-      PrintUsageMessage ();\r
+      Usage ();\r
       return STATUS_ERROR;\r
     } else {\r
       Error (NULL, 0, 0, argv[Index], "unknown option");\r
       return STATUS_ERROR;\r
     } else {\r
       Error (NULL, 0, 0, argv[Index], "unknown option");\r
@@ -781,7 +824,7 @@ Returns:
       SectionSubType = EFI_STANDARD_COMPRESSION;\r
     } else {\r
       Error (NULL, 0, 0, ParamSectionSubType, "unknown compression type");\r
       SectionSubType = EFI_STANDARD_COMPRESSION;\r
     } else {\r
       Error (NULL, 0, 0, ParamSectionSubType, "unknown compression type");\r
-      PrintUsageMessage ();\r
+      Usage ();\r
       return GetUtilityStatus ();\r
     }\r
   } else if (stricmp (ParamSectionType, SectionTypeName[EFI_SECTION_GUID_DEFINED]) == 0) {\r
       return GetUtilityStatus ();\r
     }\r
   } else if (stricmp (ParamSectionType, SectionTypeName[EFI_SECTION_GUID_DEFINED]) == 0) {\r
@@ -791,7 +834,7 @@ Returns:
       SectionSubType = EFI_SECTION_CRC32_GUID_DEFINED;\r
     } else {\r
       Error (NULL, 0, 0, ParamSectionSubType, "unknown GUID defined section type", ParamSectionSubType);\r
       SectionSubType = EFI_SECTION_CRC32_GUID_DEFINED;\r
     } else {\r
       Error (NULL, 0, 0, ParamSectionSubType, "unknown GUID defined section type", ParamSectionSubType);\r
-      PrintUsageMessage ();\r
+      Usage ();\r
       return GetUtilityStatus ();\r
     }\r
   } else if (stricmp (ParamSectionType, SectionTypeName[EFI_SECTION_PE32]) == 0) {\r
       return GetUtilityStatus ();\r
     }\r
   } else if (stricmp (ParamSectionType, SectionTypeName[EFI_SECTION_PE32]) == 0) {\r
@@ -808,7 +851,7 @@ Returns:
     Index             = sscanf (ParamVersion, "%d", &VersionNumber);\r
     if (Index != 1 || VersionNumber < 0 || VersionNumber > 65565) {\r
       Error (NULL, 0, 0, ParamVersion, "illegal version number");\r
     Index             = sscanf (ParamVersion, "%d", &VersionNumber);\r
     if (Index != 1 || VersionNumber < 0 || VersionNumber > 65565) {\r
       Error (NULL, 0, 0, ParamVersion, "illegal version number");\r
-      PrintUsageMessage ();\r
+      Usage ();\r
       return GetUtilityStatus ();\r
     }\r
 \r
       return GetUtilityStatus ();\r
     }\r
 \r
@@ -820,7 +863,7 @@ Returns:
     InputFileRequired = FALSE;\r
     if (strcmp (AuxString, PARAMETER_NOT_SPECIFIED) == 0) {\r
       Error (NULL, 0, 0, "user interface string not specified", NULL);\r
     InputFileRequired = FALSE;\r
     if (strcmp (AuxString, PARAMETER_NOT_SPECIFIED) == 0) {\r
       Error (NULL, 0, 0, "user interface string not specified", NULL);\r
-      PrintUsageMessage ();\r
+      Usage ();\r
       return GetUtilityStatus ();\r
     }\r
   } else if (stricmp (ParamSectionType, SectionTypeName[EFI_SECTION_COMPATIBILITY16]) == 0) {\r
       return GetUtilityStatus ();\r
     }\r
   } else if (stricmp (ParamSectionType, SectionTypeName[EFI_SECTION_COMPATIBILITY16]) == 0) {\r
@@ -835,7 +878,7 @@ Returns:
     SectionType = EFI_SECTION_PEI_DEPEX;\r
   } else {\r
     Error (NULL, 0, 0, ParamSectionType, "unknown section type");\r
     SectionType = EFI_SECTION_PEI_DEPEX;\r
   } else {\r
     Error (NULL, 0, 0, ParamSectionType, "unknown section type");\r
-    PrintUsageMessage ();\r
+    Usage ();\r
     return GetUtilityStatus ();\r
   }\r
   //\r
     return GetUtilityStatus ();\r
   }\r
   //\r
index 90f3b3919a689eb2fb588b42cb60e87e1c369b35..39b83326e2fb09f865a296ce50262001eeadd704 100644 (file)
@@ -34,7 +34,8 @@ Abstract:
 // Version of this utility\r
 //\r
 #define UTILITY_NAME    "GenTEImage"\r
 // Version of this utility\r
 //\r
 #define UTILITY_NAME    "GenTEImage"\r
-#define UTILITY_VERSION "v0.11"\r
+#define UTILITY_MAJOR_VERSION   0\r
+#define UTILITY_MINOR_VERSION   11\r
 \r
 //\r
 // Define the max length of a filename\r
 \r
 //\r
 // Define the max length of a filename\r
@@ -84,6 +85,12 @@ static STRING_LOOKUP  mSubsystemTypes[] = {
 //\r
 //  Function prototypes\r
 //\r
 //\r
 //  Function prototypes\r
 //\r
+static\r
+void\r
+Version (\r
+  VOID\r
+  );\r
+\r
 static\r
 void\r
 Usage (\r
 static\r
 void\r
 Usage (\r
@@ -669,6 +676,18 @@ Returns:
     Usage ();\r
     return STATUS_ERROR;\r
   }\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
   //\r
   // Process until no more arguments\r
   //\r
   //\r
   // Process until no more arguments\r
   //\r
@@ -733,6 +752,31 @@ Returns:
   return STATUS_SUCCESS;\r
 }\r
 \r
   return STATUS_SUCCESS;\r
 }\r
 \r
+static\r
+void \r
+Version(\r
+  void\r
+)\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Displays the standard utility information to SDTOUT\r
+\r
+Arguments:\r
+\r
+  None\r
+\r
+Returns:\r
+\r
+  None\r
+\r
+--*/\r
+{\r
+  printf ("%s v%d.%d -Utility to generate a TE image from an EFI PE32 image.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);\r
+  printf ("Copyright (c) 1999-2007 Intel Corporation. All rights reserved.\n");\r
+}\r
+\r
 static\r
 void\r
 Usage (\r
 static\r
 void\r
 Usage (\r
@@ -756,19 +800,21 @@ Returns:
 {\r
   int               Index;\r
   static const char *Msg[] = {\r
 {\r
   int               Index;\r
   static const char *Msg[] = {\r
-    UTILITY_NAME " version "UTILITY_VERSION " - TE image utility",\r
-    "  Generate a TE image from an EFI PE32 image",\r
-    "  Usage: "UTILITY_NAME " {-v} {-dump} {-h|-?} {-o OutFileName} InFileName",\r
+    "\nUsage: "UTILITY_NAME " {-v} {-dump} {-h|-?} {-o OutFileName} InFileName",\r
     "                [-e|-b] [FileName(s)]",\r
     "    where:",\r
     "                [-e|-b] [FileName(s)]",\r
     "    where:",\r
+    "      -h,--help,-?,/?  to display help messages",\r
+    "      -V,--version     to display version information",\r
     "      -v             - for verbose output",\r
     "      -dump          - to dump the input file to a text file",\r
     "      -v             - for verbose output",\r
     "      -dump          - to dump the input file to a text file",\r
-    "      -h -?          - for this help information",\r
     "      -o OutFileName - to write output to OutFileName rather than InFileName"DEFAULT_OUTPUT_EXTENSION,\r
     "      InFileName     - name of the input PE32 file",\r
     "",\r
     NULL\r
   };\r
     "      -o OutFileName - to write output to OutFileName rather than InFileName"DEFAULT_OUTPUT_EXTENSION,\r
     "      InFileName     - name of the input PE32 file",\r
     "",\r
     NULL\r
   };\r
+  \r
+  Version();\r
+  \r
   for (Index = 0; Msg[Index] != NULL; Index++) {\r
     fprintf (stdout, "%s\n", Msg[Index]);\r
   }\r
   for (Index = 0; Msg[Index] != NULL; Index++) {\r
     fprintf (stdout, "%s\n", Msg[Index]);\r
   }\r
index 2cab6c1a220b67454152ad0f451cdb48fd0b86e1..7115c00903b6d5577362635acb43a53cfed5d5c8 100755 (executable)
@@ -333,7 +333,7 @@ Returns:
   FILE  *fpin;\r
   FILE  *fpout;\r
 \r
   FILE  *fpin;\r
   FILE  *fpout;\r
 \r
-  if (argc < 1) {\r
+  if (argc == 1) {\r
     Usage();\r
     return -1;\r
   }\r
     Usage();\r
     return -1;\r
   }\r
index f7820bcfaf46bdb96c866eda354a93deb218e560..a7efd54936ed85265b658525fd07b80dee5e7d04 100644 (file)
@@ -108,7 +108,7 @@ Returns:
   char  *Buffer;\r
   char  *Ptrx;\r
   \r
   char  *Buffer;\r
   char  *Ptrx;\r
   \r
-  if (argc < 1) {\r
+  if (argc == 1) {\r
     Usage();\r
     return -1;\r
   }\r
     Usage();\r
     return -1;\r
   }\r