From 126be109500c7b6a17a234bcf284b217d594fa75 Mon Sep 17 00:00:00 2001 From: James Zern Date: Fri, 24 Nov 2017 14:17:51 -0800 Subject: [PATCH] webpinfo: add -version option Change-Id: I5861d5ccd2119dd6749dc70b65fd145b5a732f98 --- README | 1 + examples/webpinfo.c | 6 ++++++ man/webpinfo.1 | 13 ++++++++----- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/README b/README index facd1751..e9817bfc 100644 --- a/README +++ b/README @@ -378,6 +378,7 @@ Usage: webpinfo [options] in_files Note: there could be multiple input files; options must come before input files. Options: + -version ........... Print version number and exit. -quiet ............. Do not show chunk parsing information. -diag .............. Show parsing error diagnosis. -summary ........... Show chunk stats summary. diff --git a/examples/webpinfo.c b/examples/webpinfo.c index 4b6d78c7..cc6a70f4 100644 --- a/examples/webpinfo.c +++ b/examples/webpinfo.c @@ -1106,6 +1106,7 @@ static void HelpLong(void) { "Note: there could be multiple input files;\n" " options must come before input files.\n" "Options:\n" + " -version ........... Print version number and exit.\n" " -quiet ............. Do not show chunk parsing information.\n" " -diag .............. Show parsing error diagnosis.\n" " -summary ........... Show chunk stats summary.\n" @@ -1139,6 +1140,11 @@ int main(int argc, const char* argv[]) { show_summary = 1; } else if (!strcmp(argv[c], "-bitstream_info")) { parse_bitstream = 1; + } else if (!strcmp(argv[c], "-version")) { + const int version = WebPGetDecoderVersion(); + printf("WebP Decoder version: %d.%d.%d\n", + (version >> 16) & 0xff, (version >> 8) & 0xff, version & 0xff); + return 0; } else { // Assume the remaining are all input files. break; } diff --git a/man/webpinfo.1 b/man/webpinfo.1 index b2737591..902ba9e0 100644 --- a/man/webpinfo.1 +++ b/man/webpinfo.1 @@ -1,5 +1,5 @@ .\" Hey, EMACS: -*- nroff -*- -.TH WEBPINFO 1 "May 08, 2017" +.TH WEBPINFO 1 "November 24, 2017" .SH NAME webpinfo \- print out the chunk level structure of WebP files along with basic integrity checks. @@ -22,16 +22,19 @@ WebP format. .SH OPTIONS .TP -.B -quiet +.B \-version +Print the version number (as major.minor.revision) and exit. +.TP +.B \-quiet Do not show chunk parsing information. .TP -.B -diag +.B \-diag Show parsing error diagnosis. .TP -.B -summary +.B \-summary Show chunk stats summary. .TP -.BI -bitstream_info +.BI \-bitstream_info Parse bitstream header. .TP .B \-h, \-help