Added or modified utility version and usage display.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2162 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
ywang 2007-01-03 22:09:16 +00:00
parent 67fca228ca
commit 52be9a3b67
4 changed files with 111 additions and 22 deletions

View File

@ -2561,18 +2561,18 @@ Returns:
// //
if (argc < 1) { if (argc < 1) {
Usage(); Usage();
return -1; return 1;
} }
if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0) || if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0) ||
(strcmp(argv[1], "-?") == 0) || (strcmp(argv[1], "/?") == 0)) { (strcmp(argv[1], "-?") == 0) || (strcmp(argv[1], "/?") == 0)) {
Usage(); Usage();
return -1; return 1;
} }
if ((strcmp(argv[1], "-V") == 0) || (strcmp(argv[1], "--version") == 0)) { if ((strcmp(argv[1], "-V") == 0) || (strcmp(argv[1], "--version") == 0)) {
Version(); Version();
return -1; return 1;
} }
if (argc != ONE_BSF_ARGS && argc != TWO_BSF_ARGS) { if (argc != ONE_BSF_ARGS && argc != TWO_BSF_ARGS) {

View File

@ -1,6 +1,6 @@
/*++ /*++
Copyright (c) 2004, Intel Corporation Copyright (c) 2004-2007, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -22,9 +22,9 @@ Abstract:
#include "GenCRC32Section.h" #include "GenCRC32Section.h"
#define TOOLVERSION "0.2"
#define UTILITY_NAME "GenCrc32Section" #define UTILITY_NAME "GenCrc32Section"
#define UTILITY_MAJOR_VERSION 0
#define UTILITY_MINOR_VERSION 2
EFI_GUID gEfiCrc32SectionGuid = EFI_CRC32_GUIDED_SECTION_EXTRACTION_PROTOCOL_GUID; EFI_GUID gEfiCrc32SectionGuid = EFI_CRC32_GUIDED_SECTION_EXTRACTION_PROTOCOL_GUID;
@ -117,16 +117,45 @@ Returns:
} }
VOID VOID
PrintUsage ( Version (
VOID
)
/*++
Routine Description:
Displays the standard utility information to SDTOUT
Arguments:
None
Returns:
None
--*/
{
printf (
"%s v%d.%d -Utility for generating Firmware File System files.\n",
UTILITY_NAME,
UTILITY_MAJOR_VERSION,
UTILITY_MINOR_VERSION
);
}
VOID
Usage (
VOID VOID
) )
{ {
printf ("Usage:\n"); Version();
printf (UTILITY_NAME " -i \"inputfile1\" \"inputfile2\" -o \"outputfile\" \n");
printf (" -i \"inputfile\":\n "); printf ("\nUsage:\n");
printf (" specifies the input files that would be signed to CRC32 Guided section.\n"); printf (UTILITY_NAME " -i Inputfile1 Inputfile2 -o Outputfile\n");
printf (" -o \"outputfile\":\n"); printf (" -i Inputfile: specifies the input files signed to CRC32 Guided section.\n");
printf (" specifies the output file that is a CRC32 Guided section.\n"); printf (" -o Outputfile: specifies the output file that is a CRC32 Guided section.\n");
} }
INT32 INT32
@ -211,8 +240,19 @@ main (
SetUtilityName (UTILITY_NAME); SetUtilityName (UTILITY_NAME);
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 == 1) { if (argc == 1) {
PrintUsage (); Usage ();
return -1; return -1;
} }

View File

@ -41,7 +41,10 @@ Abstract:
#include "EfiUtilityMsgs.h" #include "EfiUtilityMsgs.h"
#define MAX_PATH 256 #define MAX_PATH 256
#define PROGRAM_NAME "GenCapsuleHdr"
#define UTILITY_NAME "GenCapsuleHdr"
#define UTILITY_MAJOR_VERSION 1
#define UTILITY_MINOR_VERSION 0
#define UNICODE_BACKSLASH L'\\' #define UNICODE_BACKSLASH L'\\'
#define UNICODE_FILE_START 0xFEFF #define UNICODE_FILE_START 0xFEFF
@ -158,6 +161,12 @@ SplitCapsule (
INT8 *CapsuleFileName INT8 *CapsuleFileName
); );
static
void
Version (
VOID
);
static static
void void
Usage ( Usage (
@ -273,7 +282,7 @@ Returns:
// //
// Specify our program name to the error printing routines. // Specify our program name to the error printing routines.
// //
SetUtilityName (PROGRAM_NAME); SetUtilityName (UTILITY_NAME);
// //
// Process the command-line arguments // Process the command-line arguments
// //
@ -2355,10 +2364,22 @@ Returns:
Argc--; Argc--;
Argv++; Argv++;
if (Argc == 0) { if (Argc < 1) {
Usage (); Usage ();
return STATUS_ERROR; return STATUS_ERROR;
} }
if ((strcmp(Argv[0], "-h") == 0) || (strcmp(Argv[0], "--help") == 0) ||
(strcmp(Argv[0], "-?") == 0) || (strcmp(Argv[0], "/?") == 0)) {
Usage();
return STATUS_ERROR;
}
if ((strcmp(Argv[0], "-V") == 0) || (strcmp(Argv[0], "--version") == 0)) {
Version();
return STATUS_ERROR;
}
// //
// Process until no more options // Process until no more options
// //
@ -2622,6 +2643,31 @@ Returns:
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
static
void
Version(
void
)
/*++
Routine Description:
Print out version information for this utility.
Arguments:
None
Returns:
None
--*/
{
printf ("%s v%d.%d -EDK utility to create a capsule header.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
printf ("Copyright (c) 1999-2006 Intel Corporation. All rights reserved.\n");
}
static static
void void
Usage ( Usage (
@ -2645,13 +2691,13 @@ Returns:
{ {
int Index; int Index;
static const char *Str[] = { static const char *Str[] = {
PROGRAM_NAME " -- create a capsule header", "\nUsage: "UTILITY_NAME " {options} [CapsuleFV]",
" Usage: "PROGRAM_NAME " {options} [CapsuleFV]",
// //
// {FfsFileNames}", // {FfsFileNames}",
// //
" Options include:", " Options include:",
" -h or -? for this help information", " -h,--help,-?,/? to display help messages",
" -V,--version to display version information",
" -script fname to take capsule header info from unicode script", " -script fname to take capsule header info from unicode script",
" file fname", " file fname",
" -o fname write output to file fname (required)", " -o fname write output to file fname (required)",
@ -2668,6 +2714,9 @@ Returns:
// //
NULL NULL
}; };
Version();
for (Index = 0; Str[Index] != NULL; Index++) { for (Index = 0; Str[Index] != NULL; Index++) {
fprintf (stdout, "%s\n", Str[Index]); fprintf (stdout, "%s\n", Str[Index]);
} }

View File

@ -50,7 +50,7 @@ Returns:
--*/ --*/
{ {
printf ("%s v%d.%d -EDK Convert EXE to BIN\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION); printf ("%s v%d.%d -EDK Utility to Convert EXE to BIN\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
printf ("Copyright (c) 2005-2006 Intel Corporation. All rights reserved.\n"); printf ("Copyright (c) 2005-2006 Intel Corporation. All rights reserved.\n");
} }