]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/CCode/Source/GuidChk/GuidChk.c
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2201 6f19259b...
[mirror_edk2.git] / Tools / CCode / Source / GuidChk / GuidChk.c
index de884058720c49898a2fb65c9e03705a87d51895..ab2d767b80f8bacf60fd1a41a9391d4ba568e307 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
@@ -33,6 +33,11 @@ Abstract:
 // Define a structure that correlates filename extensions to an enumerated\r
 // type.\r
 //\r
+\r
+#define UTILITY_NAME              "GuidChk"\r
+#define UTILITY_MAJOR_VERSION     1\r
+#define UTILITY_MINOR_VERSION     0\r
+\r
 typedef struct {\r
   INT8  *Extension;\r
   INT8  ExtensionCode;\r
@@ -119,6 +124,12 @@ ProcessArgs (
   char    *Argv[]\r
   );\r
 \r
+static\r
+VOID\r
+Version (\r
+  VOID\r
+  );\r
+\r
 static\r
 VOID\r
 Usage (\r
@@ -352,7 +363,18 @@ ProcessArgs (
     Usage ();\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
   while (Argc > 0) {\r
     //\r
     // Look for options\r
@@ -570,6 +592,32 @@ ProcessArgs (
 \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 for checking guid duplication for files in a given directory.\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
 // Print usage instructions\r
 //\r
@@ -585,21 +633,25 @@ Usage (
     "",\r
     "Usage:  GuidChk {options}\n",\r
     "  Options: ",\r
-    "    -d dirname     exclude searching of a directory",\r
-    "    -f filename    exclude searching of a file",\r
-    "    -e extension   exclude searching of files by extension",\r
-    "    -p             print all GUIDS found",\r
-    "    -g             check for duplicate guids",\r
-    "    -s             check for duplicate signatures",\r
-    "    -x             print guid+defined symbol name",\r
-    "    -b outfile     write internal GUID+basename list to outfile",\r
-    "    -u dirname     exclude searching all subdirectories of a directory",\r
-    "    -h -?          print this help text",\r
+    "    -d dirname      exclude searching of a directory",\r
+    "    -f filename     exclude searching of a file",\r
+    "    -e extension    exclude searching of files by extension",\r
+    "    -p              print all GUIDS found",\r
+    "    -g              check for duplicate guids",\r
+    "    -s              check for duplicate signatures",\r
+    "    -x              print guid+defined symbol name",\r
+    "    -b outfile      write internal GUID+basename list to outfile",\r
+    "    -u dirname      exclude searching all subdirectories of a directory",\r
+    "    -h,--help,-?,/? display help messages",\r
+    "    -V,--version    display version information",\r
     " ",\r
     "   Example: GuidChk -g -u build -d fv -f make.inf -e .pkg",\r
     "",\r
     NULL\r
   };\r
+  \r
+  Version();\r
+  \r
   for (Index = 0; Str[Index] != NULL; Index++) {\r
     fprintf (stdout, "%s\n", Str[Index]);\r
   }\r