found a bug in metacopy, the -x parameter wasn't in the optstring. rectified that

This commit is contained in:
evanokeeffe 2021-03-23 12:49:26 +00:00
parent 25ad570be7
commit 160ee8ba9b
2 changed files with 17 additions and 13 deletions

View File

@ -94,36 +94,40 @@ int Params::option(int opt, const std::string& /*optarg*/, int optopt)
{ {
int rc = 0; int rc = 0;
switch (opt) { switch (opt) {
case 'h': help_ = true; break; case 'h': {help_ = true; break;}
case 'i': iptc_ = true; break; case 'i': {iptc_ = true; break;}
case 'e': exif_ = true; break; case 'e': {exif_ = true; break;}
case 'c': comment_ = true; break; case 'c': {comment_ = true; break;}
case 'x': xmp_ = true; break; case 'x': {xmp_ = true; break;}
case 'p': preserve_ = true; break; case 'p': {preserve_ = true; break;}
case 'a': case 'a':{
iptc_ =true; iptc_ =true;
exif_ =true; exif_ =true;
comment_ =true; comment_ =true;
xmp_ =true; xmp_ =true;
break; break;
case ':': }
case ':':{
std::cerr << progname() << ": Option -" << static_cast<char>(optopt) std::cerr << progname() << ": Option -" << static_cast<char>(optopt)
<< " requires an argument\n"; << " requires an argument\n";
rc = 1; rc = 1;
break; break;
case '?': }
case '?':{
std::cerr << progname() << ": Unrecognized option -" std::cerr << progname() << ": Unrecognized option -"
<< static_cast<char>(optopt) << "\n"; << static_cast<char>(optopt) << "\n";
rc = 1; rc = 1;
break; break;
default: }
default:{
std::cerr << progname() std::cerr << progname()
<< ": getopt returned unexpected character code " << ": getopt returned unexpected character code "
<< std::hex << opt << "\n"; << std::hex << opt << "\n";
rc = 1; rc = 1;
break; break;
} }
}
return rc; return rc;
} }
@ -165,7 +169,7 @@ void Params::usage(std::ostream& os) const
{ {
os << "\nReads and writes raw metadata. Use -h option for help.\n" os << "\nReads and writes raw metadata. Use -h option for help.\n"
<< "Usage: " << progname() << "Usage: " << progname()
<< " [-iecaph] readfile writefile\n"; << " [-iecxaph] readfile writefile\n";
} }
void Params::help(std::ostream& os) const void Params::help(std::ostream& os) const

View File

@ -39,7 +39,7 @@ public:
/*! /*!
@brief Default constructor. Note that optstring_ is initialized here. @brief Default constructor. Note that optstring_ is initialized here.
*/ */
Params() : optstring_(":iecaph"), Params() : optstring_(":iecxaph"),
first_(true), first_(true),
help_(false), help_(false),
iptc_(false), iptc_(false),