This commit is contained in:
ywang 2007-01-09 22:29:27 +00:00
parent 18a964cf70
commit 60db81c16b
4 changed files with 149 additions and 34 deletions

View File

@ -2364,7 +2364,7 @@ Returns:
Argc--; Argc--;
Argv++; Argv++;
if (Argc < 1) { if (Argc == 0) {
Usage (); Usage ();
return STATUS_ERROR; 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 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
@ -33,6 +33,11 @@ Abstract:
// Define a structure that correlates filename extensions to an enumerated // Define a structure that correlates filename extensions to an enumerated
// type. // type.
// //
#define UTILITY_NAME "GuidChk"
#define UTILITY_MAJOR_VERSION 1
#define UTILITY_MINOR_VERSION 0
typedef struct { typedef struct {
INT8 *Extension; INT8 *Extension;
INT8 ExtensionCode; INT8 ExtensionCode;
@ -119,6 +124,12 @@ ProcessArgs (
char *Argv[] char *Argv[]
); );
static
VOID
Version (
VOID
);
static static
VOID VOID
Usage ( Usage (
@ -352,7 +363,18 @@ ProcessArgs (
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;
}
while (Argc > 0) { while (Argc > 0) {
// //
// Look for options // Look for options
@ -570,6 +592,32 @@ ProcessArgs (
return STATUS_SUCCESS; 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 for checking guid duplication for files in a given directory.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
printf ("Copyright (c) 1999-2007 Intel Corporation. All rights reserved.\n");
}
// //
// Print usage instructions // Print usage instructions
// //
@ -585,21 +633,25 @@ Usage (
"", "",
"Usage: GuidChk {options}\n", "Usage: GuidChk {options}\n",
" Options: ", " Options: ",
" -d dirname exclude searching of a directory", " -d dirname exclude searching of a directory",
" -f filename exclude searching of a file", " -f filename exclude searching of a file",
" -e extension exclude searching of files by extension", " -e extension exclude searching of files by extension",
" -p print all GUIDS found", " -p print all GUIDS found",
" -g check for duplicate guids", " -g check for duplicate guids",
" -s check for duplicate signatures", " -s check for duplicate signatures",
" -x print guid+defined symbol name", " -x print guid+defined symbol name",
" -b outfile write internal GUID+basename list to outfile", " -b outfile write internal GUID+basename list to outfile",
" -u dirname exclude searching all subdirectories of a directory", " -u dirname exclude searching all subdirectories of a directory",
" -h -? print this help text", " -h,--help,-?,/? display help messages",
" -V,--version display version information",
" ", " ",
" Example: GuidChk -g -u build -d fv -f make.inf -e .pkg", " Example: GuidChk -g -u build -d fv -f make.inf -e .pkg",
"", "",
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

@ -1,6 +1,6 @@
/*++ /*++
Copyright (c) 2004, Intel Corporation Copyright (c) 2004 - 20077, 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
@ -38,7 +38,9 @@ typedef struct _STRING_LIST {
char *Str; char *Str;
} STRING_LIST; } STRING_LIST;
#define UTILITY_NAME "MakeDeps" #define UTILITY_NAME "MakeDeps"
#define UTILITY_MAJOR_VERSION 1
#define UTILITY_MINOR_VERSION 0
#define MAX_LINE_LEN 2048 #define MAX_LINE_LEN 2048
#define MAX_PATH 2048 #define MAX_PATH 2048
@ -163,6 +165,12 @@ ProcessArgs (
char *Argv[] char *Argv[]
); );
static
void
Version (
VOID
);
static static
void void
Usage ( Usage (
@ -828,6 +836,23 @@ ProcessArgs (
// //
Argc--; Argc--;
Argv++; Argv++;
if (Argc == 0) {
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;
}
// //
// Initialize locals // Initialize locals
// //
@ -1233,6 +1258,31 @@ FreeLists (
// //
} }
static
void
Version(
void
)
/*++
Routine Description:
Displays the standard utility information to SDTOUT
Arguments:
None
Returns:
None
--*/
{
printf ("%s v%d.%d -Utility for generating file dependency lists for files in a given directory.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
printf ("Copyright (c) 1999-2007 Intel Corporation. All rights reserved.\n");
}
static static
void void
Usage ( Usage (
@ -1259,7 +1309,8 @@ Returns:
UTILITY_NAME " -- make dependencies", UTILITY_NAME " -- make dependencies",
" Usage: MakeDeps [options]", " Usage: MakeDeps [options]",
" Options include:", " Options include:",
" -h or -? for this help information", " -h,--help,-?,/? display help messages",
" -V,--version display version information",
" -f SourceFile add SourceFile to list of files to scan", " -f SourceFile add SourceFile to list of files to scan",
" -i IncludePath add IncludePath to list of search paths", " -i IncludePath add IncludePath to list of search paths",
" -o OutputFile write output dependencies to OutputFile", " -o OutputFile write output dependencies to OutputFile",
@ -1278,6 +1329,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

@ -1,6 +1,6 @@
/*++ /*++
Copyright (c) 2004-2006 Intel Corporation. All rights reserved Copyright (c) 2004-2007 Intel Corporation. All rights reserved
This program and the accompanying materials are licensed and made available This program and the accompanying materials are licensed and made available
under the terms and conditions of the BSD License which accompanies this under the terms and conditions of the BSD License which accompanies this
distribution. The full text of the license may be found at distribution. The full text of the license may be found at
@ -63,7 +63,7 @@ EFI_GUID NewFvPadFileNameGuid = { 0x145372bc, 0x66b9, 0x476d, 0x81, 0xbc, 0
UINT8 ApResetVector[5] = {0xEA, 0xD0, 0xFF, 0x00, 0xF0}; UINT8 ApResetVector[5] = {0xEA, 0xD0, 0xFF, 0x00, 0xF0};
VOID VOID
PrintUtilityInfo ( Version (
VOID VOID
) )
/*++ /*++
@ -82,16 +82,12 @@ Returns:
--*/ --*/
{ {
printf ( printf ("%s v%d.%d -Tiano IA32 SEC Ap Reset Vector Fixup Utility.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
"%s - Tiano IA32 SEC Ap Reset Vector Fixup Utility."" Version %i.%i\n\n", printf ("Copyright (c) 1999-2007 Intel Corporation. All rights reserved.\n");
UTILITY_NAME,
UTILITY_MAJOR_VERSION,
UTILITY_MINOR_VERSION
);
} }
VOID VOID
PrintUsage ( Usage (
VOID VOID
) )
/*++ /*++
@ -110,10 +106,12 @@ Returns:
--*/ --*/
{ {
printf ("Usage: %s InputFvrecoveryFile OutputFvrecoveryFile\n", UTILITY_NAME); Version();
printf ("\nUsage: %s InputFvrecoveryFile OutputFvrecoveryFile\n", UTILITY_NAME);
printf (" Where:\n"); printf (" Where:\n");
printf ("\tInputFvrecoveryFile - Name of the IA32 input Fvrecovery.fv file.\n"); printf (" InputFvrecoveryFile - Name of the IA32 input Fvrecovery.fv file.\n");
printf ("\tOutputFvrecoveryFile - Name of the IA32 output Fvrecovery.fv file.\n"); printf (" OutputFvrecoveryFile - Name of the IA32 output Fvrecovery.fv file.\n");
} }
@ -216,17 +214,28 @@ Returns:
TempGuid = NULL; TempGuid = NULL;
SetUtilityName (UTILITY_NAME); SetUtilityName (UTILITY_NAME);
// if (argc == 1) {
// Display utility information Usage();
// return STATUS_ERROR;
PrintUtilityInfo (); }
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;
}
// //
// Verify the correct number of arguments // Verify the correct number of arguments
// //
if (argc != MAX_ARGS) { if (argc != MAX_ARGS) {
Error (NULL, 0, 0, "invalid number of input parameters specified", NULL); Error (NULL, 0, 0, "invalid number of input parameters specified", NULL);
PrintUsage (); Usage ();
return STATUS_ERROR; return STATUS_ERROR;
} }
// //