From a85cb24e2bb75a9ad063db978d1f91ae036850ca Mon Sep 17 00:00:00 2001 From: ywang Date: Tue, 14 Nov 2006 22:01:45 +0000 Subject: File modified to add usage information and implement minor corrections. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1954 6f19259b-4bc3-4df7-8a09-765794883524 --- Tools/CCode/Source/ModifyInf/ModifyInf.c | 74 ++++++++++++++++++++++++++++---- 1 file changed, 66 insertions(+), 8 deletions(-) (limited to 'Tools/CCode/Source/ModifyInf/ModifyInf.c') diff --git a/Tools/CCode/Source/ModifyInf/ModifyInf.c b/Tools/CCode/Source/ModifyInf/ModifyInf.c index 6008feb981..5e3d17ddf4 100755 --- a/Tools/CCode/Source/ModifyInf/ModifyInf.c +++ b/Tools/CCode/Source/ModifyInf/ModifyInf.c @@ -24,6 +24,10 @@ Abstract: #include "stdio.h" #include "string.h" +#define UTILITY_NAME "ModifyInf" +#define UTILITY_MAJOR_VERSION 1 +#define UTILITY_MINOR_VERSION 1 + // // Read a line into buffer including '\r\n' // @@ -242,29 +246,67 @@ Returns: return 0; } -void -Usage ( +void +MIVersion( void ) /*++ Routine Description: - GC_TODO: Add function description + Print out version information for Strip. Arguments: None - + Returns: - GC_TODO: add return values + None + +--*/ +{ + printf ("%s v%d.%d -EDK Modify fields in FV inf files.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION); + printf ("Copyright (c) 2005-2006 Intel Corporation. All rights reserved.\n"); +} ---*/ +void +MIUsage( + void + ) +/*++ + +Routine Description: + + Print out usage information for Strip. + +Arguments: + + None + +Returns: + + None + +--*/ { - printf ("ModifyInf InputFVInfFileName OutputFVInfFileName [Pattern strings]\r\n"); + MIVersion(); + printf ("\n Usage: %s InputFile OutputFile Pattern_String [Pattern_String бн]\n\ + Where: \n\ + Pattern_String is of the format (note that the section name must be \n\ + enclosed within square brackets):\n\ + [section]FieldKeyValue [(FieldKeyValue) бн] \n\ + The operator, , must be one of the following: \n\ + '==' replace a field value with a new value \n\ + '+=' append a string at the end of original line \n\ + '-' prevent the line from applying any patterns \n\ + Example: \n\ + ModifyInf BuildRootFvFvMain.inf BuildRootFvFvMainEXP.inf \\ \n\ + [files]EFI_FILE_NAME+=.Org EFI_NUM_BLOCKS==0x20 \\ \n\ + [options]EFI_FILENAME==FcMainCompact.fv -DpsdSignature.dxe \n", UTILITY_NAME); } + int main ( int argc, @@ -291,8 +333,24 @@ Returns: FILE *fpin; FILE *fpout; + if (argc < 1) { + MIUsage(); + return -1; + } + + if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0) || + (strcmp(argv[1], "-?") == 0) || (strcmp(argv[1], "/?") == 0)) { + MIUsage(); + return 0; + } + + if ((strcmp(argv[1], "-V") == 0) || (strcmp(argv[1], "--version") == 0)) { + MIVersion(); + return 0; + } + if (argc < 3) { - Usage (); + MIUsage(); return -1; } -- cgit v1.2.3