]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/C/VolInfo/VolInfo.c
BaseTools-Source: Update displayed version information
[mirror_edk2.git] / BaseTools / Source / C / VolInfo / VolInfo.c
index 9962d387a7ec2c6eddbc9e460423e05a02445999..4fa87d41eea0e0b64ee2df141cffd199c010ff9b 100644 (file)
@@ -1,6 +1,7 @@
 /** @file\r
+The tool dumps the contents of a firmware volume\r
 \r
-Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 1999 - 2016, Intel Corporation. All rights reserved.<BR>
 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
@@ -9,14 +10,6 @@ http://opensource.org/licenses/bsd-license.php
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
-Module Name:\r
-\r
-  VolInfo.c\r
-\r
-Abstract:\r
-\r
-  The tool dumps the contents of a firmware volume\r
-\r
 **/\r
 \r
 #include <stdio.h>\r
@@ -24,6 +17,9 @@ Abstract:
 #include <string.h>\r
 #include <ctype.h>\r
 #include <assert.h>\r
+#ifdef __GNUC__\r
+#include <unistd.h>\r
+#endif\r
 \r
 #include <FvLib.h>\r
 #include <Common/UefiBaseTypes.h>\r
@@ -50,8 +46,8 @@ Abstract:
 \r
 EFI_GUID  gEfiCrc32GuidedSectionExtractionProtocolGuid = EFI_CRC32_GUIDED_SECTION_EXTRACTION_PROTOCOL_GUID;\r
 \r
-#define UTILITY_MAJOR_VERSION      0\r
-#define UTILITY_MINOR_VERSION      83\r
+#define UTILITY_MAJOR_VERSION      1
+#define UTILITY_MINOR_VERSION      0
 \r
 #define UTILITY_NAME         "VolInfo"\r
 \r
@@ -172,12 +168,11 @@ Returns:
   //\r
   // Print utility header\r
   //\r
-  printf ("%s Version %d.%d %s, %s\n",\r
+  printf ("%s Version %d.%d Build %s\n",
     UTILITY_NAME,\r
     UTILITY_MAJOR_VERSION,\r
     UTILITY_MINOR_VERSION,\r
-    __BUILD_VERSION,\r
-    __DATE__\r
+    __BUILD_VERSION
     );\r
 \r
   //\r
@@ -235,7 +230,7 @@ Returns:
   //\r
   if (argc != 1) {\r
     Usage ();\r
-    return -1;\r
+    return STATUS_ERROR;
   }\r
   //\r
   // Look for help options\r
@@ -243,9 +238,14 @@ Returns:
   if ((strcmp(argv[0], "-h") == 0) || (strcmp(argv[0], "--help") == 0) || \r
       (strcmp(argv[0], "-?") == 0) || (strcmp(argv[0], "/?") == 0)) {\r
     Usage();\r
-    return STATUS_ERROR;\r
+    return STATUS_SUCCESS;
+  }
+  //
+  // Version has already been printed, return success.
+  //
+  if (strcmp(argv[0], "--version") == 0) {
+    return STATUS_SUCCESS;
   }\r
-\r
   //\r
   // Open the file containing the FV\r
   //\r
@@ -1429,9 +1429,21 @@ Returns:
           );\r
 \r
       if (ExtractionTool != NULL) {\r
-\r
+       #ifndef __GNUC__\r
         ToolInputFile = CloneString (tmpnam (NULL));\r
         ToolOutputFile = CloneString (tmpnam (NULL));\r
+       #else\r
+        char tmp1[] = "/tmp/fileXXXXXX";\r
+        char tmp2[] = "/tmp/fileXXXXXX";\r
+        int fd1;\r
+        int fd2;\r
+        fd1 = mkstemp(tmp1);\r
+        fd2 = mkstemp(tmp2);\r
+        ToolInputFile = CloneString(tmp1);\r
+        ToolOutputFile = CloneString(tmp2);\r
+        close(fd1);\r
+        close(fd2);\r
+       #endif\r
 \r
         //\r
         // Construction 'system' command string\r
@@ -1716,7 +1728,7 @@ Returns:
   CHAR8             Line[MAX_LINE_LEN];\r
   GUID_TO_BASENAME  *GPtr;\r
 \r
-  if ((Fptr = fopen (FileName, "r")) == NULL) {\r
+  if ((Fptr = fopen (LongFilePath (FileName), "r")) == NULL) {\r
     printf ("ERROR: Failed to open input cross-reference file '%s'\n", FileName);\r
     return EFI_DEVICE_ERROR;\r
   }\r
@@ -1838,7 +1850,7 @@ Returns:
   //\r
   // Copyright declaration\r
   // \r
-  fprintf (stdout, "Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.\n\n");\r
+  fprintf (stdout, "Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.\n\n");
   fprintf (stdout, "  Display Tiano Firmware Volume FFS image information\n\n");\r
 \r
   //\r
@@ -1849,6 +1861,8 @@ Returns:
             Parse basename to file-guid cross reference file(s).\n");\r
   fprintf (stdout, "  --offset offset\n\\r
             Offset of file to start processing FV at.\n");\r
+  fprintf (stdout, "  --version\n\
+            Display version of this tool and exit.\n");
   fprintf (stdout, "  -h, --help\n\\r
             Show this help message and exit.\n");\r
 \r