]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Added/modified utility usage and version display.
authorywang <ywang@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 10 Jan 2007 20:52:01 +0000 (20:52 +0000)
committerywang <ywang@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 10 Jan 2007 20:52:01 +0000 (20:52 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2209 6f19259b-4bc3-4df7-8a09-765794883524

Tools/CCode/Source/PeiRebase/PeiRebaseExe.c
Tools/CCode/Source/PeiRebase/PeiRebaseExe.h

index e153110c312fcae63986ef6942ffcdaca8f74aef..c234ccffaaed3173a04d676418a0a07893638953 100644 (file)
@@ -104,11 +104,28 @@ Returns:
   // Set utility name for error/warning reporting purposes.\r
   //\r
   SetUtilityName (UTILITY_NAME);\r
+  \r
+  if (argc == 1) {\r
+    Usage();\r
+    return STATUS_ERROR;\r
+  }\r
+    \r
+  if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0) ||\r
+      (strcmp(argv[1], "-?") == 0) || (strcmp(argv[1], "/?") == 0)) {\r
+    Usage();\r
+    return STATUS_ERROR;\r
+  }\r
+  \r
+  if ((strcmp(argv[1], "-V") == 0) || (strcmp(argv[1], "--version") == 0)) {\r
+    Version();\r
+    return STATUS_ERROR;\r
+  }\r
\r
   //\r
   // Verify the correct number of arguments\r
   //\r
   if (argc != MAX_ARGS) {\r
-    PrintUsage ();\r
+    Usage ();\r
     return STATUS_ERROR;\r
   }\r
 \r
@@ -135,7 +152,7 @@ Returns:
     // Make sure argument pair begin with - or /\r
     //\r
     if (argv[Index][0] != '-' && argv[Index][0] != '/') {\r
-      PrintUsage ();\r
+      Usage ();\r
       Error (NULL, 0, 0, argv[Index], "unrecognized option");\r
       return STATUS_ERROR;\r
     }\r
@@ -143,7 +160,7 @@ Returns:
     // Make sure argument specifier is only one letter\r
     //\r
     if (argv[Index][2] != 0) {\r
-      PrintUsage ();\r
+      Usage ();\r
       Error (NULL, 0, 0, argv[Index], "unrecognized option");\r
       return STATUS_ERROR;\r
     }\r
@@ -156,7 +173,7 @@ Returns:
       if (strlen (InputFileName) == 0) {\r
         strcpy (InputFileName, argv[Index + 1]);\r
       } else {\r
-        PrintUsage ();\r
+        Usage ();\r
         Error (NULL, 0, 0, argv[Index + 1], "only one -i InputFileName may be specified");\r
         return STATUS_ERROR;\r
       }\r
@@ -167,7 +184,7 @@ Returns:
       if (OutputFileName == NULL) {\r
         OutputFileName = argv[Index + 1];\r
       } else {\r
-        PrintUsage ();\r
+        Usage ();\r
         Error (NULL, 0, 0, argv[Index + 1], "only one -o OutputFileName may be specified");\r
         return STATUS_ERROR;\r
       }\r
@@ -204,14 +221,14 @@ Returns:
     case 'B':\r
     case 'b':\r
       if (BaseTypes & 1) {\r
-        PrintUsage ();\r
+        Usage ();\r
         Error (NULL, 0, 0, argv[Index + 1], "XipBaseAddress may be specified only once by either -b or -f");\r
         return STATUS_ERROR;\r
       }\r
 \r
       Status = AsciiStringToUint64 (argv[Index + 1], FALSE, &XipBase);\r
       if (EFI_ERROR (Status)) {\r
-        PrintUsage ();\r
+        Usage ();\r
         Error (NULL, 0, 0, argv[Index + 1], "invalid hex digit given for XIP base address");\r
         return STATUS_ERROR;\r
       }\r
@@ -222,14 +239,14 @@ Returns:
     case 'D':\r
     case 'd':\r
       if (BaseTypes & 2) {\r
-        PrintUsage ();\r
+        Usage ();\r
         Error (NULL, 0, 0, argv[Index + 1], "-d BsBaseAddress may be specified only once");\r
         return STATUS_ERROR;\r
       }\r
 \r
       Status = AsciiStringToUint64 (argv[Index + 1], FALSE, &BsBase);\r
       if (EFI_ERROR (Status)) {\r
-        PrintUsage ();\r
+        Usage ();\r
         Error (NULL, 0, 0, argv[Index + 1], "invalid hex digit given for BS_DRIVER base address");\r
         return STATUS_ERROR;\r
       }\r
@@ -240,14 +257,14 @@ Returns:
     case 'R':\r
     case 'r':\r
       if (BaseTypes & 4) {\r
-        PrintUsage ();\r
+        Usage ();\r
         Error (NULL, 0, 0, argv[Index + 1], "-r RtBaseAddress may be specified only once");\r
         return STATUS_ERROR;\r
       }\r
 \r
       Status = AsciiStringToUint64 (argv[Index + 1], FALSE, &RtBase);\r
       if (EFI_ERROR (Status)) {\r
-        PrintUsage ();\r
+        Usage ();\r
         Error (NULL, 0, 0, argv[Index + 1], "invalid hex digit given for RT_DRIVER base address");\r
         return STATUS_ERROR;\r
       }\r
@@ -256,7 +273,7 @@ Returns:
       break;\r
 \r
     default:\r
-      PrintUsage ();\r
+      Usage ();\r
       Error (NULL, 0, 0, argv[Index], "unrecognized argument");\r
       return STATUS_ERROR;\r
       break;\r
@@ -490,7 +507,7 @@ Returns:
 }\r
 \r
 VOID\r
-PrintUtilityInfo (\r
+Version (\r
   VOID\r
   )\r
 /*++\r
@@ -509,17 +526,12 @@ Returns:
 \r
 --*/\r
 {\r
-  printf (\r
-    "%s, PEI Rebase Utility. Version %i.%i, %s.\n\n",\r
-    UTILITY_NAME,\r
-    UTILITY_MAJOR_VERSION,\r
-    UTILITY_MINOR_VERSION,\r
-    UTILITY_DATE\r
-    );\r
+  printf ("%s v%d.%d -PEI Rebase Utility.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);\r
+  printf ("Copyright (c) 1999-2007 Intel Corporation. All rights reserved.\n");\r
 }\r
 \r
 VOID\r
-PrintUsage (\r
+Usage (\r
   VOID\r
   )\r
 /*++\r
@@ -538,15 +550,17 @@ Returns:
 \r
 --*/\r
 {\r
+  Version();\r
+  \r
   printf (\r
-    "Usage: %s -I InputFileName -O OutputFileName -B BaseAddress\n",\r
+    "\nUsage: %s -I InputFileName -O OutputFileName -B BaseAddress\n",\r
     UTILITY_NAME\r
     );\r
   printf ("  Where:\n");\r
-  printf ("    InputFileName is the name of the EFI FV file to rebase.\n");\r
-  printf ("    OutputFileName is the desired output file name.\n");\r
-  printf ("    BaseAddress is the FV base address to rebase against.\n");\r
-  printf ("  Argument pair may be in any order.\n\n");\r
+  printf ("     InputFileName is the name of the EFI FV file to rebase.\n");\r
+  printf ("     OutputFileName is the desired output file name.\n");\r
+  printf ("     BaseAddress is the FV base address to rebase agains.\n");\r
+  printf ("  Argument pair may be in any order.\n");\r
 }\r
 \r
 EFI_STATUS\r
index 253387e6ab02dd06fa5fae704d605529847ce5d9..1c5b6929c32e6329c349a4ef20862d599ad7b7d6 100644 (file)
@@ -54,7 +54,7 @@ Abstract:
 // The function that displays general utility information\r
 //\r
 VOID\r
-PrintUtilityInfo (\r
+Version (\r
   VOID\r
   )\r
 /*++\r
@@ -78,7 +78,7 @@ Returns:
 // The function that displays the utility usage message.\r
 //\r
 VOID\r
-PrintUsage (\r
+Usage (\r
   VOID\r
   )\r
 /*++\r