]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/CCode/Source/ModifyInf/ModifyInf.c
File modified to add usage information and implement minor corrections.
[mirror_edk2.git] / Tools / CCode / Source / ModifyInf / ModifyInf.c
index 6008feb9813a4564dcdfe72b3593900dec651f47..5e3d17ddf431d6af19c5a3d92538f5b5fa392570 100755 (executable)
@@ -24,6 +24,10 @@ Abstract:
 #include "stdio.h"\r
 #include "string.h"\r
 \r
+#define UTILITY_NAME "ModifyInf"\r
+#define UTILITY_MAJOR_VERSION 1\r
+#define UTILITY_MINOR_VERSION 1\r
+\r
 //\r
 // Read a line into buffer including '\r\n'\r
 //\r
@@ -242,29 +246,67 @@ Returns:
   return 0;\r
 }\r
 \r
-void\r
-Usage (\r
+void \r
+MIVersion(\r
   void\r
   )\r
 /*++\r
 \r
 Routine Description:\r
 \r
-  GC_TODO: Add function description\r
+  Print out version information for Strip.\r
 \r
 Arguments:\r
 \r
   None\r
-\r
+  \r
 Returns:\r
 \r
-  GC_TODO: add return values\r
+  None\r
+  \r
+--*/ \r
+{\r
+  printf ("%s v%d.%d -EDK Modify fields in FV inf files.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);\r
+  printf ("Copyright (c) 2005-2006 Intel Corporation. All rights reserved.\n");\r
+}\r
 \r
---*/\r
+void \r
+MIUsage(\r
+  void\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Print out usage information for Strip.\r
+\r
+Arguments:\r
+\r
+  None\r
+  \r
+Returns:\r
+\r
+  None\r
+  \r
+--*/ \r
 {\r
-  printf ("ModifyInf InputFVInfFileName OutputFVInfFileName [Pattern strings]\r\n");\r
+  MIVersion();\r
+  printf ("\n Usage: %s InputFile OutputFile Pattern_String [Pattern_String ¡­]\n\\r
+   Where: \n\\r
+     Pattern_String is of the format (note that the section name must be \n\\r
+     enclosed within square brackets):\n\\r
+         [section]FieldKey<op>Value [(FieldKey<op>Value) ¡­] \n\\r
+     The operator, <op>, must be one of the following: \n\\r
+         '==' replace a field value with a new value \n\\r
+         '+=' append a string at the end of original line \n\\r
+         '-'  prevent the line from applying any patterns \n\\r
+     Example: \n\\r
+         ModifyInf BuildRootFvFvMain.inf BuildRootFvFvMainEXP.inf \\ \n\\r
+               [files]EFI_FILE_NAME+=.Org EFI_NUM_BLOCKS==0x20 \\ \n\\r
+               [options]EFI_FILENAME==FcMainCompact.fv -DpsdSignature.dxe \n", UTILITY_NAME);\r
 }\r
 \r
+\r
 int\r
 main (\r
   int argc,\r
@@ -291,8 +333,24 @@ Returns:
   FILE  *fpin;\r
   FILE  *fpout;\r
 \r
+  if (argc < 1) {\r
+    MIUsage();\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
+    MIUsage();\r
+    return 0;\r
+  }\r
+  \r
+  if ((strcmp(argv[1], "-V") == 0) || (strcmp(argv[1], "--version") == 0)) {\r
+    MIVersion();\r
+    return 0;\r
+  }\r
+  \r
   if (argc < 3) {\r
-    Usage ();\r
+    MIUsage();\r
     return -1;\r
   }\r
 \r