public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Song, BinX" <binx.song@intel.com>
To: "edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Gao, Liming" <liming.gao@intel.com>
Subject: [PATCH] BaseTools: Add --version option in Brotli and BrotliCompress
Date: Fri, 7 Apr 2017 08:50:30 +0000	[thread overview]
Message-ID: <559D2DF22BC9A3468B4FA1AA547F0EF10255ACCB@shsmsx102.ccr.corp.intel.com> (raw)

https://bugzilla.tianocore.org/show_bug.cgi?id=464
- Add --version option in Brotli and BrotliCompress

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Bell Song <binx.song@intel.com>
---
 BaseTools/BinWrappers/PosixLike/BrotliCompress       | 3 +++
 BaseTools/Source/C/BrotliCompress/BrotliCompress.bat | 6 ++++++
 BaseTools/Source/C/BrotliCompress/tools/bro.c        | 8 +++++++-
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/BaseTools/BinWrappers/PosixLike/BrotliCompress b/BaseTools/BinWrappers/PosixLike/BrotliCompress
index 59c6465..f7a2079 100755
--- a/BaseTools/BinWrappers/PosixLike/BrotliCompress
+++ b/BaseTools/BinWrappers/PosixLike/BrotliCompress
@@ -32,6 +32,9 @@ while [ $# != 0 ];do
       ARGS+="--output $2 "
       shift
     ;;
+    --version)
+      ARGS+="$1 "
+    ;;
     *)
       ARGS+="--input $1 "
   esac
diff --git a/BaseTools/Source/C/BrotliCompress/BrotliCompress.bat b/BaseTools/Source/C/BrotliCompress/BrotliCompress.bat
index 257bf1e..5949782 100644
--- a/BaseTools/Source/C/BrotliCompress/BrotliCompress.bat
+++ b/BaseTools/Source/C/BrotliCompress/BrotliCompress.bat
@@ -52,6 +52,12 @@ if "%1"=="-o" (
   goto Begin
 )
 
+if "%1"=="--version" (
+  set ARGS=%ARGS% %1
+  shift
+  goto Begin
+)
+
 set ARGS=%ARGS% --input %1
 shift
 goto Begin
diff --git a/BaseTools/Source/C/BrotliCompress/tools/bro.c b/BaseTools/Source/C/BrotliCompress/tools/bro.c
index 2fa9f05..df54738 100644
--- a/BaseTools/Source/C/BrotliCompress/tools/bro.c
+++ b/BaseTools/Source/C/BrotliCompress/tools/bro.c
@@ -67,6 +67,8 @@ static int ParseQuality(const char* s, int* quality) {
   return 0;
 }
 
+#define BRO_VER  "0.5.2"
+
 static void ParseArgv(int argc, char **argv,
                       char **input_path,
                       char **output_path,
@@ -110,6 +112,9 @@ static void ParseArgv(int argc, char **argv,
       }
       *verbose = 1;
       continue;
+    } else if (!strcmp("--version", argv[k])) {
+      fprintf(stderr, "Brotli Version %s\n", BRO_VER);
+      exit(1);
     }
     if (k < argc - 1) {
       if (!strcmp("--input", argv[k]) ||
@@ -177,7 +182,8 @@ error:
   fprintf(stderr,
           "Usage: %s [--force] [--quality n] [--gap n] [--decompress]"
           " [--input filename] [--output filename] [--repeat iters]"
-          " [--verbose] [--window n] [--custom-dictionary filename]\n",
+          " [--verbose] [--window n] [--custom-dictionary filename]"
+          " [--version]\n",
           argv[0]);
   exit(1);
 }
-- 
2.10.2.windows.1



             reply	other threads:[~2017-04-07  8:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-07  8:50 Song, BinX [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-04-13  1:19 [PATCH] BaseTools: Add --version option in Brotli and BrotliCompress Song, BinX
2017-04-13  6:34 ` Gao, Liming

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=559D2DF22BC9A3468B4FA1AA547F0EF10255ACCB@shsmsx102.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox