]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/CCode/Source/GenDepex/GenDepex.c
File modified to add usage information and implement minor corrections.
[mirror_edk2.git] / Tools / CCode / Source / GenDepex / GenDepex.c
index 3818649330555051e951ae5883c11833d6b76d13..b010102e260c99b3735d7bf74157e3e5f2b3bf34 100644 (file)
@@ -1,6 +1,6 @@
 /*++\r
 \r
-Copyright (c) 2004, Intel Corporation                                                         \r
+Copyright (c) 2004-2006, 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
@@ -86,7 +86,7 @@ ParseDepex (
   );\r
 \r
 VOID\r
-PrintGenDepexUtilityInfo (\r
+GDVersion (\r
   VOID\r
   )\r
 /*++\r
@@ -111,11 +111,11 @@ Returns:
     UTILITY_MAJOR_VERSION,\r
     UTILITY_MINOR_VERSION\r
     );\r
-  printf ("Copyright (C) 1996-2002 Intel Corporation.  All rights reserved.\n\n");\r
+  printf ("Copyright (C) 1996-2006 Intel Corporation. All rights reserved.\n");\r
 }\r
 \r
 VOID\r
-PrintGenDepexUsageInfo (\r
+GDUsage (\r
   VOID\r
   )\r
 /*++\r
@@ -134,15 +134,16 @@ Returns:
 \r
 --*/\r
 {\r
+  GDVersion();\r
   printf (\r
-    "Usage: %s -I <INFILE> -O <OUTFILE> [-P <Optional Boundary for padding up>] \n",\r
+    "\n  Usage: %s -I InputFile -O OutputFile [-P <Optional Boundary for padding up>] \n",\r
     UTILITY_NAME\r
     );\r
-  printf (" Where:\n");\r
-  printf ("  <INFILE> is the input pre-processed dependency text files name.\n");\r
-  printf ("  <OUTFILE> is the output binary dependency files name.\n");\r
-  printf ("  <Optional Boundary for padding up> is the padding integer value.\n");\r
-  printf ("    This is the boundary to align the output file size to.\n");\r
+  printf ("  Where:\n");\r
+  printf ("    InputFile is the input pre-processed dependency text files name.\n");\r
+  printf ("    OutputFile is the output binary dependency files name.\n");\r
+  printf ("    <Optional Boundary for padding up> is the padding integer value.\n");\r
+  printf ("       This is the boundary to align the output file size to.\n");\r
 }\r
 \r
 DEPENDENCY_OPCODE\r
@@ -855,9 +856,25 @@ Returns:
   Output_Flag = FALSE;\r
   Pad_Flag    = FALSE;\r
 \r
+  if (argc < 1) {\r
+    GDUsage();\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
+    GDUsage();\r
+    return 0;\r
+  }\r
+  \r
+  if ((strcmp(argv[1], "-V") == 0) || (strcmp(argv[1], "--version") == 0)) {\r
+    GDVersion();\r
+    return 0;\r
+  }\r
+  \r
   if (argc < 5) {\r
     printf ("Not enough arguments\n");\r
-    PrintGenDepexUsageInfo ();\r
+    GDUsage();\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
@@ -901,17 +918,15 @@ Returns:
     }\r
   }\r
 \r
-  PrintGenDepexUtilityInfo ();\r
-\r
   if (InFile == NULL) {\r
     printf ("Can not open <INFILE> for reading.\n");\r
-    PrintGenDepexUsageInfo ();\r
+    GDUsage();\r
     return EFI_ABORTED;\r
   }\r
 \r
   if (OutFile == NULL) {\r
     printf ("Can not open <OUTFILE> for writting.\n");\r
-    PrintGenDepexUsageInfo ();\r
+    GDUsage();\r
     return EFI_ABORTED;\r
   }\r
 \r