From c71e12b899e73f267b9a4df33d5bfd38924fe9e2 Mon Sep 17 00:00:00 2001 From: Andreas Huggel Date: Fri, 10 Sep 2010 15:00:15 +0000 Subject: [PATCH] Added option -q (quiet) to silence warnings and error messages from the Exiv2 library to the exiv2 command line tool. --- src/exiv2.1 | 7 ++++++- src/exiv2.cpp | 2 ++ src/exiv2app.hpp | 2 +- test/data/exiv2-test.out | 1 + 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/exiv2.1 b/src/exiv2.1 index fb337236..637648e7 100644 --- a/src/exiv2.1 +++ b/src/exiv2.1 @@ -3,7 +3,7 @@ .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) -.TH EXIV2 1 "Feb 14, 2010" +.TH EXIV2 1 "Sep 10, 2010" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -127,6 +127,11 @@ Show the program version and exit. .B \-v Be verbose during the program run. .TP +.B \-q +Silence warnings and error messages from the Exiv2 library during the +program run (quiet). Note that options \fB\-v\fP and \fB\-q\fP can be +used at the same time. +.TP .B \-b Show large binary values (default is to suppress them). .TP diff --git a/src/exiv2.cpp b/src/exiv2.cpp index 6127a4e8..3ae33795 100644 --- a/src/exiv2.cpp +++ b/src/exiv2.cpp @@ -256,6 +256,7 @@ void Params::help(std::ostream& os) const << _(" -h Display this help and exit.\n") << _(" -V Show the program version and exit.\n") << _(" -v Be verbose during the program run.\n") + << _(" -q Silence warnings and error messages during the program run (quiet).\n") << _(" -b Show large binary values.\n") << _(" -u Show unknown tags.\n") << _(" -g key Only output info for this key (grep).\n") @@ -336,6 +337,7 @@ int Params::option(int opt, const std::string& optarg, int optopt) case 'h': help_ = true; break; case 'V': version_ = true; break; case 'v': verbose_ = true; break; + case 'q': Exiv2::LogMsg::setLevel(Exiv2::LogMsg::mute); break; case 'k': preserve_ = true; break; case 'b': binary_ = false; break; case 'u': unknown_ = false; break; diff --git a/src/exiv2app.hpp b/src/exiv2app.hpp index f8aada94..f010a71e 100644 --- a/src/exiv2app.hpp +++ b/src/exiv2app.hpp @@ -220,7 +220,7 @@ private: @brief Default constructor. Note that optstring_ is initialized here. The c'tor is private to force instantiation through instance(). */ - Params() : optstring_(":hVvfbuktTFa:Y:O:D:r:p:P:d:e:i:c:m:M:l:S:g:n:"), + Params() : optstring_(":hVvqfbuktTFa:Y:O:D:r:p:P:d:e:i:c:m:M:l:S:g:n:"), help_(false), version_(false), verbose_(false), diff --git a/test/data/exiv2-test.out b/test/data/exiv2-test.out index fe938591..3c1b9884 100644 --- a/test/data/exiv2-test.out +++ b/test/data/exiv2-test.out @@ -49,6 +49,7 @@ Options: -h Display this help and exit. -V Show the program version and exit. -v Be verbose during the program run. + -q Silence warnings and error messages during the program run (quiet). -b Show large binary values. -u Show unknown tags. -g key Only output info for this key (grep).