From f091efb3cb895692a55c310c368943bb4c108ba1 Mon Sep 17 00:00:00 2001 From: ywang Date: Tue, 2 Jan 2007 20:17:36 +0000 Subject: Added or modified utility version and usage display. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2159 6f19259b-4bc3-4df7-8a09-765794883524 --- Tools/CCode/Source/GenBsfImage/GenBsfImage.c | 53 +++++++++++++++++----------- Tools/CCode/Source/GenBsfImage/GenBsfImage.h | 2 +- 2 files changed, 34 insertions(+), 21 deletions(-) (limited to 'Tools/CCode/Source/GenBsfImage') diff --git a/Tools/CCode/Source/GenBsfImage/GenBsfImage.c b/Tools/CCode/Source/GenBsfImage/GenBsfImage.c index 494f3495c6..1c9dff9258 100644 --- a/Tools/CCode/Source/GenBsfImage/GenBsfImage.c +++ b/Tools/CCode/Source/GenBsfImage/GenBsfImage.c @@ -2357,7 +2357,7 @@ Returns: } VOID -PrintUtilityInfo ( +Version ( VOID ) /*++ @@ -2377,16 +2377,15 @@ Returns: --*/ { printf ( - "%s, EFI 2.0 BootStrap File Generation Utility. Version %i.%i, %s.\n\n", + "%s, EFI 2.0 BootStrap File Generation Utility. Version %i.%i.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, - UTILITY_MINOR_VERSION, - UTILITY_DATE + UTILITY_MINOR_VERSION ); } VOID -PrintUsage ( +Usage ( VOID ) /*++ @@ -2405,13 +2404,16 @@ Returns: --*/ { + Version(); + printf ( - "Usage: %s -B BaseAddress -S FwVolumeSize\n", + "\nUsage: %s -B BaseAddress -S FwVolumeSize\n", UTILITY_NAME ); printf (" Where:\n"); - printf ("\tBaseAddress is the starting address of Firmware Volume where\n\tBoot Strapped Image will reside.\n\n"); - printf ("\tFwVolumeSize is the size of Firmware Volume.\n\n"); + printf (" BaseAddress is the starting address of Firmware Volume where Boot\n"); + printf (" Strapped Image will reside.\n"); + printf (" FwVolumeSize is the size of Firmware Volume.\n"); } EFI_STATUS @@ -2454,11 +2456,6 @@ Returns: EFI_STATUS Status; BOOLEAN IsIA32; - // - // Display utility information - // - PrintUtilityInfo (); - // // Verify the correct number of IA32 arguments // @@ -2486,7 +2483,7 @@ Returns: // Make sure argument pair begin with - or / // if (argv[Index][0] != '-' && argv[Index][0] != '/') { - PrintUsage (); + Usage (); printf ("ERROR: Argument pair must begin with \"-\" or \"/\"\n"); return 1; } @@ -2495,7 +2492,7 @@ Returns: // Make sure argument specifier is only one letter // if (argv[Index][2] != 0) { - PrintUsage (); + Usage (); printf ("ERROR: Unrecognized argument \"%s\".\n", argv[Index]); return 1; } @@ -2515,7 +2512,7 @@ Returns: break; default: - PrintUsage (); + Usage (); printf ("Unrecognized IA32 argument \"%s\".\n", argv[Index]); IsIA32 = FALSE; break; @@ -2562,8 +2559,24 @@ Returns: // // Verify the correct number of arguments // + if (argc < 1) { + Usage(); + return -1; + } + + if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0) || + (strcmp(argv[1], "-?") == 0) || (strcmp(argv[1], "/?") == 0)) { + Usage(); + return -1; + } + + if ((strcmp(argv[1], "-V") == 0) || (strcmp(argv[1], "--version") == 0)) { + Version(); + return -1; + } + if (argc != ONE_BSF_ARGS && argc != TWO_BSF_ARGS) { - PrintUsage (); + Usage (); return 1; } @@ -2586,7 +2599,7 @@ Returns: // Make sure argument pair begin with - or / // if (argv[Index][0] != '-' && argv[Index][0] != '/') { - PrintUsage (); + Usage (); printf ("ERROR: Argument pair must begin with \"-\" or \"/\"\n"); return 1; } @@ -2595,7 +2608,7 @@ Returns: // Make sure argument specifier is only one letter // if (argv[Index][2] != 0) { - PrintUsage (); + Usage (); printf ("ERROR: Unrecognized argument \"%s\".\n", argv[Index]); return 1; } @@ -2636,7 +2649,7 @@ Returns: break; default: - PrintUsage (); + Usage (); printf ("ERROR: Unrecognized argument \"%s\".\n", argv[Index]); return 1; break; diff --git a/Tools/CCode/Source/GenBsfImage/GenBsfImage.h b/Tools/CCode/Source/GenBsfImage/GenBsfImage.h index 63db1218d5..4b6e6ea7b5 100644 --- a/Tools/CCode/Source/GenBsfImage/GenBsfImage.h +++ b/Tools/CCode/Source/GenBsfImage/GenBsfImage.h @@ -128,7 +128,7 @@ Abstract: // Utility version information // #define UTILITY_MAJOR_VERSION 0 -#define UTILITY_MINOR_VERSION 0 +#define UTILITY_MINOR_VERSION 1 #define UTILITY_DATE __DATE__ // -- cgit v1.2.3