]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
BaseTools: Change source files to DOS format.
[mirror_edk2.git] / BaseTools / Source / C / VfrCompile / VfrCompiler.cpp
index ee10605edb4f873b603c8f08eb1b1b8ceb815ea5..695ce6cc484c846aaf5261df9d0566d72b97d291 100644 (file)
@@ -2,7 +2,7 @@
   \r
   VfrCompiler main class and main function.\r
 \r
-Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials                          \r
 are licensed and made available under the terms and conditions of the BSD License         \r
 which accompanies this distribution.  The full text of the license may be found at        \r
@@ -96,6 +96,10 @@ CVfrCompiler::OptionInitialization (
       Usage ();\r
       SET_RUN_STATUS (STATUS_DEAD);\r
       return;\r
+    } else if (stricmp(Argv[Index], "--version") == 0) {\r
+      Version ();\r
+      SET_RUN_STATUS (STATUS_DEAD);\r
+      return;\r
     } else if (stricmp(Argv[Index], "-l") == 0) {\r
       mOptions.CreateRecordListFile = TRUE;\r
       gCIfrRecordInfoDB.TurnOn ();\r
@@ -408,13 +412,14 @@ CVfrCompiler::Usage (
   UINT32 Index;\r
   CONST  CHAR8 *Help[] = {\r
     " ", \r
-    "VfrCompile version " VFR_COMPILER_VERSION __BUILD_VERSION,\r
-    "Copyright (c) 2004-2013 Intel Corporation. All rights reserved.",\r
+    "VfrCompile version " VFR_COMPILER_VERSION "Build " __BUILD_VERSION,\r
+    "Copyright (c) 2004-2016 Intel Corporation. All rights reserved.",\r
     " ",\r
     "Usage: VfrCompile [options] VfrFile",\r
     " ",\r
     "Options:",\r
     "  -h, --help     prints this help",\r
+    "  --version      prints version info",\r
     "  -l             create an output IFR listing file",\r
     "  -o DIR, --output-directory DIR",\r
     "                 deposit all output files to directory OutputDir",\r
@@ -439,6 +444,21 @@ CVfrCompiler::Usage (
   }\r
 }\r
 \r
+VOID \r
+CVfrCompiler::Version (\r
+  VOID\r
+  )\r
+{\r
+  UINT32 Index;\r
+  CONST  CHAR8 *Help[] = {\r
+    "VfrCompile version " VFR_COMPILER_VERSION "Build " __BUILD_VERSION,\r
+    NULL\r
+    };\r
+  for (Index = 0; Help[Index] != NULL; Index++) {\r
+    fprintf (stdout, "%s\n", Help[Index]);\r
+  }\r
+}\r
+\r
 VOID\r
 CVfrCompiler::PreProcess (\r
   VOID\r
@@ -456,7 +476,7 @@ CVfrCompiler::PreProcess (
     goto Out;\r
   }\r
 \r
-  if ((pVfrFile = fopen (mOptions.VfrFileName, "r")) == NULL) {\r
+  if ((pVfrFile = fopen (LongFilePath (mOptions.VfrFileName), "r")) == NULL) {\r
     DebugError (NULL, 0, 0001, "Error opening the input VFR file", mOptions.VfrFileName);\r
     goto Fail;\r
   }\r
@@ -525,7 +545,7 @@ CVfrCompiler::Compile (
   gCVfrErrorHandle.SetInputFile (InFileName);\r
   gCVfrErrorHandle.SetWarningAsError(mOptions.WarningAsError);\r
 \r
-  if ((pInFile = fopen (InFileName, "r")) == NULL) {\r
+  if ((pInFile = fopen (LongFilePath (InFileName), "r")) == NULL) {\r
     DebugError (NULL, 0, 0001, "Error opening the input file", InFileName);\r
     goto Fail;\r
   }\r
@@ -679,7 +699,7 @@ CVfrCompiler::GenBinary (
   }\r
 \r
   if (mOptions.CreateIfrPkgFile == TRUE) {\r
-    if ((pFile = fopen (mOptions.PkgOutputFileName, "wb")) == NULL) {\r
+    if ((pFile = fopen (LongFilePath (mOptions.PkgOutputFileName), "wb")) == NULL) {\r
       DebugError (NULL, 0, 0001, "Error opening file", mOptions.PkgOutputFileName);\r
       goto Fail;\r
     }\r
@@ -722,7 +742,7 @@ CVfrCompiler::GenCFile (
   }\r
   \r
   if (!mOptions.CreateIfrPkgFile || mOptions.CompatibleMode) {\r
-    if ((pFile = fopen (mOptions.COutputFileName, "w")) == NULL) {\r
+    if ((pFile = fopen (LongFilePath (mOptions.COutputFileName), "w")) == NULL) {\r
       DebugError (NULL, 0, 0001, "Error opening output C file", mOptions.COutputFileName);\r
       goto Fail;\r
     }\r
@@ -769,12 +789,12 @@ CVfrCompiler::GenRecordListFile (
       return;\r
     }\r
 \r
-    if ((pInFile = fopen (InFileName, "r")) == NULL) {\r
+    if ((pInFile = fopen (LongFilePath (InFileName), "r")) == NULL) {\r
       DebugError (NULL, 0, 0001, "Error opening the input VFR preprocessor output file", InFileName);\r
       return;\r
     }\r
 \r
-    if ((pOutFile = fopen (mOptions.RecordListFile, "w")) == NULL) {\r
+    if ((pOutFile = fopen (LongFilePath (mOptions.RecordListFile), "w")) == NULL) {\r
       DebugError (NULL, 0, 0001, "Error opening the record list file", mOptions.RecordListFile);\r
       goto Err1;\r
     }\r