summaryrefslogtreecommitdiff
path: root/Tools/CCode
diff options
context:
space:
mode:
authorywang <ywang@6f19259b-4bc3-4df7-8a09-765794883524>2007-01-10 20:52:01 +0000
committerywang <ywang@6f19259b-4bc3-4df7-8a09-765794883524>2007-01-10 20:52:01 +0000
commitfd23b925fbc72e96c85082a042932e4eb370d735 (patch)
tree4b6f723f5755d59f9fc65d0d84cbf7d5beff12fc /Tools/CCode
parent715a44f11b0af748a1febc2c2cf4c7d955403b3e (diff)
downloadedk2-platforms-fd23b925fbc72e96c85082a042932e4eb370d735.tar.xz
Added/modified utility usage and version display.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2209 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Tools/CCode')
-rw-r--r--Tools/CCode/Source/PeiRebase/PeiRebaseExe.c66
-rw-r--r--Tools/CCode/Source/PeiRebase/PeiRebaseExe.h4
2 files changed, 42 insertions, 28 deletions
diff --git a/Tools/CCode/Source/PeiRebase/PeiRebaseExe.c b/Tools/CCode/Source/PeiRebase/PeiRebaseExe.c
index e153110c31..c234ccffaa 100644
--- a/Tools/CCode/Source/PeiRebase/PeiRebaseExe.c
+++ b/Tools/CCode/Source/PeiRebase/PeiRebaseExe.c
@@ -104,11 +104,28 @@ Returns:
// Set utility name for error/warning reporting purposes.
//
SetUtilityName (UTILITY_NAME);
+
+ 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 STATUS_ERROR;
+ }
+
+ if ((strcmp(argv[1], "-V") == 0) || (strcmp(argv[1], "--version") == 0)) {
+ Version();
+ return STATUS_ERROR;
+ }
+
//
// Verify the correct number of arguments
//
if (argc != MAX_ARGS) {
- PrintUsage ();
+ Usage ();
return STATUS_ERROR;
}
@@ -135,7 +152,7 @@ Returns:
// Make sure argument pair begin with - or /
//
if (argv[Index][0] != '-' && argv[Index][0] != '/') {
- PrintUsage ();
+ Usage ();
Error (NULL, 0, 0, argv[Index], "unrecognized option");
return STATUS_ERROR;
}
@@ -143,7 +160,7 @@ Returns:
// Make sure argument specifier is only one letter
//
if (argv[Index][2] != 0) {
- PrintUsage ();
+ Usage ();
Error (NULL, 0, 0, argv[Index], "unrecognized option");
return STATUS_ERROR;
}
@@ -156,7 +173,7 @@ Returns:
if (strlen (InputFileName) == 0) {
strcpy (InputFileName, argv[Index + 1]);
} else {
- PrintUsage ();
+ Usage ();
Error (NULL, 0, 0, argv[Index + 1], "only one -i InputFileName may be specified");
return STATUS_ERROR;
}
@@ -167,7 +184,7 @@ Returns:
if (OutputFileName == NULL) {
OutputFileName = argv[Index + 1];
} else {
- PrintUsage ();
+ Usage ();
Error (NULL, 0, 0, argv[Index + 1], "only one -o OutputFileName may be specified");
return STATUS_ERROR;
}
@@ -204,14 +221,14 @@ Returns:
case 'B':
case 'b':
if (BaseTypes & 1) {
- PrintUsage ();
+ Usage ();
Error (NULL, 0, 0, argv[Index + 1], "XipBaseAddress may be specified only once by either -b or -f");
return STATUS_ERROR;
}
Status = AsciiStringToUint64 (argv[Index + 1], FALSE, &XipBase);
if (EFI_ERROR (Status)) {
- PrintUsage ();
+ Usage ();
Error (NULL, 0, 0, argv[Index + 1], "invalid hex digit given for XIP base address");
return STATUS_ERROR;
}
@@ -222,14 +239,14 @@ Returns:
case 'D':
case 'd':
if (BaseTypes & 2) {
- PrintUsage ();
+ Usage ();
Error (NULL, 0, 0, argv[Index + 1], "-d BsBaseAddress may be specified only once");
return STATUS_ERROR;
}
Status = AsciiStringToUint64 (argv[Index + 1], FALSE, &BsBase);
if (EFI_ERROR (Status)) {
- PrintUsage ();
+ Usage ();
Error (NULL, 0, 0, argv[Index + 1], "invalid hex digit given for BS_DRIVER base address");
return STATUS_ERROR;
}
@@ -240,14 +257,14 @@ Returns:
case 'R':
case 'r':
if (BaseTypes & 4) {
- PrintUsage ();
+ Usage ();
Error (NULL, 0, 0, argv[Index + 1], "-r RtBaseAddress may be specified only once");
return STATUS_ERROR;
}
Status = AsciiStringToUint64 (argv[Index + 1], FALSE, &RtBase);
if (EFI_ERROR (Status)) {
- PrintUsage ();
+ Usage ();
Error (NULL, 0, 0, argv[Index + 1], "invalid hex digit given for RT_DRIVER base address");
return STATUS_ERROR;
}
@@ -256,7 +273,7 @@ Returns:
break;
default:
- PrintUsage ();
+ Usage ();
Error (NULL, 0, 0, argv[Index], "unrecognized argument");
return STATUS_ERROR;
break;
@@ -490,7 +507,7 @@ Returns:
}
VOID
-PrintUtilityInfo (
+Version (
VOID
)
/*++
@@ -509,17 +526,12 @@ Returns:
--*/
{
- printf (
- "%s, PEI Rebase Utility. Version %i.%i, %s.\n\n",
- UTILITY_NAME,
- UTILITY_MAJOR_VERSION,
- UTILITY_MINOR_VERSION,
- UTILITY_DATE
- );
+ printf ("%s v%d.%d -PEI Rebase Utility.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
+ printf ("Copyright (c) 1999-2007 Intel Corporation. All rights reserved.\n");
}
VOID
-PrintUsage (
+Usage (
VOID
)
/*++
@@ -538,15 +550,17 @@ Returns:
--*/
{
+ Version();
+
printf (
- "Usage: %s -I InputFileName -O OutputFileName -B BaseAddress\n",
+ "\nUsage: %s -I InputFileName -O OutputFileName -B BaseAddress\n",
UTILITY_NAME
);
printf (" Where:\n");
- printf (" InputFileName is the name of the EFI FV file to rebase.\n");
- printf (" OutputFileName is the desired output file name.\n");
- printf (" BaseAddress is the FV base address to rebase against.\n");
- printf (" Argument pair may be in any order.\n\n");
+ printf (" InputFileName is the name of the EFI FV file to rebase.\n");
+ printf (" OutputFileName is the desired output file name.\n");
+ printf (" BaseAddress is the FV base address to rebase agains.\n");
+ printf (" Argument pair may be in any order.\n");
}
EFI_STATUS
diff --git a/Tools/CCode/Source/PeiRebase/PeiRebaseExe.h b/Tools/CCode/Source/PeiRebase/PeiRebaseExe.h
index 253387e6ab..1c5b6929c3 100644
--- a/Tools/CCode/Source/PeiRebase/PeiRebaseExe.h
+++ b/Tools/CCode/Source/PeiRebase/PeiRebaseExe.h
@@ -54,7 +54,7 @@ Abstract:
// The function that displays general utility information
//
VOID
-PrintUtilityInfo (
+Version (
VOID
)
/*++
@@ -78,7 +78,7 @@ Returns:
// The function that displays the utility usage message.
//
VOID
-PrintUsage (
+Usage (
VOID
)
/*++