Minor changes and bug fixes implemented.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2196 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
ywang 2007-01-08 22:27:20 +00:00
parent 66d8c20686
commit db608e6b5b
13 changed files with 237 additions and 76 deletions

View File

@ -121,7 +121,7 @@ Returns:
SrcBuffer = DstBuffer = NULL;
infile = outfile = NULL;
if (argc < 1) {
if (argc == 1) {
Usage();
goto Done;
}

View File

@ -762,7 +762,7 @@ Returns:
TimeStamp = 0;
TimeStampPresent = FALSE;
if (argc < 1) {
if (argc == 1) {
Usage();
return STATUS_ERROR;
}

View File

@ -394,7 +394,7 @@ Returns:
Index = 0;
Invert = 0;
if (argc < 1) {
if (argc == 1) {
Usage();
return -1;
}

View File

@ -2559,7 +2559,7 @@ Returns:
//
// Verify the correct number of arguments
//
if (argc < 1) {
if (argc == 1) {
Usage();
return 1;
}

View File

@ -239,6 +239,11 @@ main (
OutputFileName = NULL;
SetUtilityName (UTILITY_NAME);
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)) {
@ -250,11 +255,6 @@ main (
Version();
return -1;
}
if (argc == 1) {
Usage ();
return -1;
}
BufferSize = 1024 * 1024 * 16;
FileBuffer = (UINT8 *) malloc (BufferSize * sizeof (UINT8));

View File

@ -2379,6 +2379,11 @@ Returns:
Version();
return STATUS_ERROR;
}
if (Argc == 1) {
Usage ();
return STATUS_ERROR;
}
//
// Process until no more options

View File

@ -106,7 +106,7 @@ Returns:
--*/
{
printf (
"%s, Tiano Dependency Expression Generation Utility. Version %d.%d.\n",
"%s v%d.%d -Tiano utility to generate dependency expression.\n",
UTILITY_NAME,
UTILITY_MAJOR_VERSION,
UTILITY_MINOR_VERSION
@ -855,16 +855,22 @@ Returns:
Output_Flag = FALSE;
Pad_Flag = FALSE;
//
// Output the calling arguments
//
printf ("\n\n");
for (Index = 0; Index < argc; Index++) {
printf ("%s ", argv[Index]);
if (argc == 1) {
Usage();
return EFI_INVALID_PARAMETER;
}
printf ("\n\n");
if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0) ||
(strcmp(argv[1], "-?") == 0) || (strcmp(argv[1], "/?") == 0)) {
Usage();
return EFI_INVALID_PARAMETER;
}
if ((strcmp(argv[1], "-V") == 0) || (strcmp(argv[1], "--version") == 0)) {
Version();
return EFI_INVALID_PARAMETER;
}
if (argc < 5) {
printf ("Not enough arguments\n");
Usage();

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
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
@ -46,8 +46,10 @@ Abstract:
#include "EfiUtilityMsgs.h"
#include "SimpleFileParsing.h"
#define UTILITY_NAME "GenFfsFile"
#define TOOLVERSION "0.32"
#define UTILITY_NAME "GenFfsFile"
#define UTILITY_MAJOR_VERSION 0
#define UTILITY_MINOR_VERSION 32
#define MAX_ARRAY_SIZE 100
static
@ -83,7 +85,13 @@ ProcessCommandLineArgs (
static
void
PrintUsage (
Version (
void
);
static
void
Usage (
void
);
@ -134,9 +142,34 @@ Returns:
String[Index - Index2] = 0;
}
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 generate a Firmware File System files.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
printf ("Copyright (c) 1999-2007 Intel Corporation. All rights reserved.\n");
}
static
void
PrintUsage (
Usage (
void
)
/*++
@ -155,7 +188,9 @@ Returns:
--*/
{
printf ("Usage:\n");
Version();
printf ("\nUsage:\n");
printf (UTILITY_NAME " -b \"build directory\" -p1 \"package1.inf\" -p2 \"package2.inf\" -v\n");
printf (" -b \"build directory\":\n ");
printf (" specifies the full path to the component build directory.\n");
@ -2545,14 +2580,27 @@ Returns:
//
// If no args, then print usage instructions and return an error
//
if (Argc == 1) {
PrintUsage ();
return STATUS_ERROR;
}
memset (&mGlobals, 0, sizeof (mGlobals));
Argc--;
Argv++;
if (Argc < 1) {
Usage ();
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;
}
memset (&mGlobals, 0, sizeof (mGlobals));
while (Argc > 0) {
if (strcmpi (Argv[0], "-b") == 0) {
//
@ -2617,17 +2665,17 @@ Returns:
//
// OPTION: -h help
//
PrintUsage ();
Usage ();
return STATUS_ERROR;
} else if (strcmpi (Argv[0], "-?") == 0) {
//
// OPTION: -? help
//
PrintUsage ();
Usage ();
return STATUS_ERROR;
} else {
Error (NULL, 0, 0, Argv[0], "unrecognized option");
PrintUsage ();
Usage ();
return STATUS_ERROR;
}

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
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
@ -29,10 +29,11 @@ Abstract:
#include "CommonLib.h"
#include "EfiUtilityMsgs.h"
VOID
PrintUtilityInfo (
VOID
)
static
void
Version(
void
)
/*++
Routine Description:
@ -49,17 +50,15 @@ Returns:
--*/
{
printf (
"%s - Tiano Firmware Volume Generation Utility."" Version %i.%i\n\n",
UTILITY_NAME,
UTILITY_MAJOR_VERSION,
UTILITY_MINOR_VERSION
);
printf ("%s v%d.%d -Tiano Firmware Volume Generation Utility.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
printf ("Copyright (c) 1999-2007 Intel Corporation. All rights reserved.\n");
}
VOID
PrintUsage (
VOID
static
void
Usage(
void
)
/*++
@ -77,9 +76,11 @@ Returns:
--*/
{
printf ("Usage: %s -I FvInfFileName\n", UTILITY_NAME);
Version();
printf ("\nUsage: %s -I FvInfFileName\n", UTILITY_NAME);
printf (" Where:\n");
printf ("\tFvInfFileName is the name of the image description file.\n\n");
printf (" FvInfFileName is the name of the image description file.\n\n");
}
int
@ -133,17 +134,29 @@ Returns:
SymFileName = SymFileNameBuffer;
SetUtilityName (UTILITY_NAME);
//
// Display utility information
//
PrintUtilityInfo ();
if (argc == 1) {
Usage ();
return STATUS_ERROR;
}
if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0) ||
(strcmp(argv[1], "-?") == 0) || (strcmp(argv[1], "/?") == 0)) {
Usage();
return GetUtilityStatus ();
}
if ((strcmp(argv[1], "-V") == 0) || (strcmp(argv[1], "--version") == 0)) {
Version();
return GetUtilityStatus ();
}
//
// Verify the correct number of arguments
//
if (argc != MAX_ARGS) {
Error (NULL, 0, 0, "invalid number of input parameters specified", NULL);
PrintUsage ();
Usage ();
return GetUtilityStatus ();
}
//
@ -160,7 +173,7 @@ Returns:
//
if (argv[Index][0] != '-' && argv[Index][0] != '/') {
Error (NULL, 0, 0, argv[Index], "argument pair must begin with \"-\" or \"/\"");
PrintUsage ();
Usage ();
return GetUtilityStatus ();
}
//
@ -168,7 +181,7 @@ Returns:
//
if (argv[Index][2] != 0) {
Error (NULL, 0, 0, argv[Index], "unrecognized argument");
PrintUsage ();
Usage ();
return GetUtilityStatus ();
}
//
@ -182,14 +195,14 @@ Returns:
strcpy (InfFileName, argv[Index + 1]);
} else {
Error (NULL, 0, 0, argv[Index + 1], "FvInfFileName may only be specified once");
PrintUsage ();
Usage ();
return GetUtilityStatus ();
}
break;
default:
Error (NULL, 0, 0, argv[Index], "unrecognized argument");
PrintUsage ();
Usage ();
return GetUtilityStatus ();
break;
}

View File

@ -36,6 +36,9 @@ Abstract:
#define UTILITY_NAME "GenSection"
#define UTILITY_MAJOR_VERSION 0
#define UTILITY_MINOR_VERSION 1
#define PARAMETER_NOT_SPECIFIED "Parameter not specified"
#define MAXIMUM_INPUT_FILE_NUM 10
@ -75,16 +78,43 @@ char *CompressionTypeName[] = { "NONE", "STANDARD" };
char *GUIDedSectionTypeName[] = { "CRC32" };
EFI_GUID gEfiCrc32SectionGuid = EFI_CRC32_GUIDED_SECTION_EXTRACTION_PROTOCOL_GUID;
static
void
Version(
void
)
/*++
Routine Description:
Print out version information for this utility.
Arguments:
None
Returns:
None
--*/
{
printf ("%s v%d.%d -Utility to create output file with formed section per the FV spec.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
printf ("Copyright (c) 1999-2007 Intel Corporation. All rights reserved.\n");
}
static
VOID
PrintUsageMessage (
Usage (
VOID
)
{
UINTN SectionType;
UINTN DisplayCount;
printf ("Usage: "UTILITY_NAME " -i InputFile -o OutputFile -s SectionType [SectionType params]\n\n");
Version();
printf ("\nUsage: "UTILITY_NAME " -i InputFile -o OutputFile -s SectionType [SectionType params]\n\n");
printf (" Where SectionType is one of the following section types:\n\n");
DisplayCount = 0;
@ -659,10 +689,23 @@ Returns:
Status = EFI_SUCCESS;
SetUtilityName (UTILITY_NAME);
if (argc == 1) {
PrintUsageMessage ();
Usage ();
return STATUS_ERROR;
}
if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0) ||
(strcmp(argv[1], "-?") == 0) || (strcmp(argv[1], "/?") == 0)) {
Usage();
return STATUS_ERROR;
}
if ((strcmp(argv[1], "-V") == 0) || (strcmp(argv[1], "--version") == 0)) {
Version();
return STATUS_ERROR;
}
//
// Parse command line
//
@ -758,7 +801,7 @@ Returns:
Index++;
ParamDigitalSignature = argv[Index];
} else if (strcmpi (argv[Index], "-?") == 0) {
PrintUsageMessage ();
Usage ();
return STATUS_ERROR;
} else {
Error (NULL, 0, 0, argv[Index], "unknown option");
@ -781,7 +824,7 @@ Returns:
SectionSubType = EFI_STANDARD_COMPRESSION;
} else {
Error (NULL, 0, 0, ParamSectionSubType, "unknown compression type");
PrintUsageMessage ();
Usage ();
return GetUtilityStatus ();
}
} else if (stricmp (ParamSectionType, SectionTypeName[EFI_SECTION_GUID_DEFINED]) == 0) {
@ -791,7 +834,7 @@ Returns:
SectionSubType = EFI_SECTION_CRC32_GUID_DEFINED;
} else {
Error (NULL, 0, 0, ParamSectionSubType, "unknown GUID defined section type", ParamSectionSubType);
PrintUsageMessage ();
Usage ();
return GetUtilityStatus ();
}
} else if (stricmp (ParamSectionType, SectionTypeName[EFI_SECTION_PE32]) == 0) {
@ -808,7 +851,7 @@ Returns:
Index = sscanf (ParamVersion, "%d", &VersionNumber);
if (Index != 1 || VersionNumber < 0 || VersionNumber > 65565) {
Error (NULL, 0, 0, ParamVersion, "illegal version number");
PrintUsageMessage ();
Usage ();
return GetUtilityStatus ();
}
@ -820,7 +863,7 @@ Returns:
InputFileRequired = FALSE;
if (strcmp (AuxString, PARAMETER_NOT_SPECIFIED) == 0) {
Error (NULL, 0, 0, "user interface string not specified", NULL);
PrintUsageMessage ();
Usage ();
return GetUtilityStatus ();
}
} else if (stricmp (ParamSectionType, SectionTypeName[EFI_SECTION_COMPATIBILITY16]) == 0) {
@ -835,7 +878,7 @@ Returns:
SectionType = EFI_SECTION_PEI_DEPEX;
} else {
Error (NULL, 0, 0, ParamSectionType, "unknown section type");
PrintUsageMessage ();
Usage ();
return GetUtilityStatus ();
}
//

View File

@ -34,7 +34,8 @@ Abstract:
// Version of this utility
//
#define UTILITY_NAME "GenTEImage"
#define UTILITY_VERSION "v0.11"
#define UTILITY_MAJOR_VERSION 0
#define UTILITY_MINOR_VERSION 11
//
// Define the max length of a filename
@ -84,6 +85,12 @@ static STRING_LOOKUP mSubsystemTypes[] = {
//
// Function prototypes
//
static
void
Version (
VOID
);
static
void
Usage (
@ -669,6 +676,18 @@ Returns:
Usage ();
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 arguments
//
@ -733,6 +752,31 @@ Returns:
return STATUS_SUCCESS;
}
static
void
Version(
void
)
/*++
Routine Description:
Displays the standard utility information to SDTOUT
Arguments:
None
Returns:
None
--*/
{
printf ("%s v%d.%d -Utility to generate a TE image from an EFI PE32 image.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
printf ("Copyright (c) 1999-2007 Intel Corporation. All rights reserved.\n");
}
static
void
Usage (
@ -756,19 +800,21 @@ Returns:
{
int Index;
static const char *Msg[] = {
UTILITY_NAME " version "UTILITY_VERSION " - TE image utility",
" Generate a TE image from an EFI PE32 image",
" Usage: "UTILITY_NAME " {-v} {-dump} {-h|-?} {-o OutFileName} InFileName",
"\nUsage: "UTILITY_NAME " {-v} {-dump} {-h|-?} {-o OutFileName} InFileName",
" [-e|-b] [FileName(s)]",
" where:",
" -h,--help,-?,/? to display help messages",
" -V,--version to display version information",
" -v - for verbose output",
" -dump - to dump the input file to a text file",
" -h -? - for this help information",
" -o OutFileName - to write output to OutFileName rather than InFileName"DEFAULT_OUTPUT_EXTENSION,
" InFileName - name of the input PE32 file",
"",
NULL
};
Version();
for (Index = 0; Msg[Index] != NULL; Index++) {
fprintf (stdout, "%s\n", Msg[Index]);
}

View File

@ -333,7 +333,7 @@ Returns:
FILE *fpin;
FILE *fpout;
if (argc < 1) {
if (argc == 1) {
Usage();
return -1;
}

View File

@ -108,7 +108,7 @@ Returns:
char *Buffer;
char *Ptrx;
if (argc < 1) {
if (argc == 1) {
Usage();
return -1;
}