BaseTools: Add --version option in Brotli and BrotliCompress

https://bugzilla.tianocore.org/show_bug.cgi?id=464
V2:
- Add build version

V1:
- Add --version option in Brotli and BrotliCompress

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Bell Song <binx.song@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
Song, BinX
2017-04-13 09:19:48 +08:00
committed by Liming Gao
parent 9ee3283bfb
commit 98cb468435
3 changed files with 60 additions and 27 deletions

View File

@@ -13,6 +13,7 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <time.h>
#include <Common/BuildVersion.h>
#include "../dec/decode.h"
#include "../enc/encode.h"
@@ -67,6 +68,11 @@ static int ParseQuality(const char* s, int* quality) {
return 0;
}
#define UTILITY_NAME "Brotli"
#define UTILITY_MAJOR_VERSION 0
#define UTILITY_MINOR_VERSION 5
#define UTILITY_REVERSION 2
static void ParseArgv(int argc, char **argv,
char **input_path,
char **output_path,
@@ -110,6 +116,15 @@ static void ParseArgv(int argc, char **argv,
}
*verbose = 1;
continue;
} else if (!strcmp("--version", argv[k])) {
fprintf(stderr,
"%s Version %d.%d.%d %s\n",
UTILITY_NAME,
UTILITY_MAJOR_VERSION,
UTILITY_MINOR_VERSION,
UTILITY_REVERSION,
__BUILD_VERSION);
exit(1);
}
if (k < argc - 1) {
if (!strcmp("--input", argv[k]) ||
@@ -177,7 +192,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);
}