]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/C/BrotliCompress/tools/bro.c
BaseTools: Add --version option in Brotli and BrotliCompress
[mirror_edk2.git] / BaseTools / Source / C / BrotliCompress / tools / bro.c
index 2fa9f05e7f21f68d73ea9dc4a1ac376fbede8b02..ef4592d420f43d90663202f3f135ec38a025eb28 100644 (file)
@@ -13,6 +13,7 @@
 #include <sys/stat.h>\r
 #include <sys/types.h>\r
 #include <time.h>\r
+#include <Common/BuildVersion.h>\r
 \r
 #include "../dec/decode.h"\r
 #include "../enc/encode.h"\r
@@ -67,6 +68,11 @@ static int ParseQuality(const char* s, int* quality) {
   return 0;\r
 }\r
 \r
+#define UTILITY_NAME          "Brotli"\r
+#define UTILITY_MAJOR_VERSION 0\r
+#define UTILITY_MINOR_VERSION 5\r
+#define UTILITY_REVERSION     2\r
+\r
 static void ParseArgv(int argc, char **argv,\r
                       char **input_path,\r
                       char **output_path,\r
@@ -110,6 +116,15 @@ static void ParseArgv(int argc, char **argv,
       }\r
       *verbose = 1;\r
       continue;\r
+    } else if (!strcmp("--version", argv[k])) {\r
+      fprintf(stderr,\r
+              "%s Version %d.%d.%d %s\n",\r
+              UTILITY_NAME,\r
+              UTILITY_MAJOR_VERSION,\r
+              UTILITY_MINOR_VERSION,\r
+              UTILITY_REVERSION,\r
+              __BUILD_VERSION);\r
+      exit(1);\r
     }\r
     if (k < argc - 1) {\r
       if (!strcmp("--input", argv[k]) ||\r
@@ -177,7 +192,8 @@ error:
   fprintf(stderr,\r
           "Usage: %s [--force] [--quality n] [--gap n] [--decompress]"\r
           " [--input filename] [--output filename] [--repeat iters]"\r
-          " [--verbose] [--window n] [--custom-dictionary filename]\n",\r
+          " [--verbose] [--window n] [--custom-dictionary filename]"\r
+          " [--version]\n",\r
           argv[0]);\r
   exit(1);\r
 }\r