int Params::option(int opt, const std::string& optarg, int optopt) { int rc = 0; switch (opt) { 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 'Q': rc = setLogLevel(optarg); break; case 'k': preserve_ = true; break; case 'b': binary_ = false; break; case 'u': unknown_ = false; break; case 'f': force_ = true; fileExistsPolicy_ = overwritePolicy; break; case 'F': force_ = true; fileExistsPolicy_ = renamePolicy; break; case 'g': rc = evalGrep(optarg); printMode_ = pmList; break; case 'K': rc = evalKey(optarg); printMode_ = pmList; break; case 'n': charset_ = optarg; break; case 'r': rc = evalRename(opt, optarg); break; case 't': rc = evalRename(opt, optarg); break; case 'T': rc = evalRename(opt, optarg); break; case 'a': rc = evalAdjust(optarg); break; case 'Y': rc = evalYodAdjust(yodYear, optarg); break; case 'O': rc = evalYodAdjust(yodMonth, optarg); break; case 'D': rc = evalYodAdjust(yodDay, optarg); break; case 'p': rc = evalPrint(optarg); break; case 'P': rc = evalPrintFlags(optarg); break; case 'd': rc = evalDelete(optarg); break; case 'e': rc = evalExtract(optarg); break; case 'i': rc = evalInsert(optarg); break; case 'c': rc = evalModify(opt, optarg); break; case 'm': rc = evalModify(opt, optarg); break; case 'M': rc = evalModify(opt, optarg); break; case 'l': directory_ = optarg; break; case 'S': suffix_ = optarg; break; case ':': std::cerr << progname() << ": " << _("Option") << " -" << static_cast<char>(optopt) << " " << _("requires an argument\n"); rc = 1; break; case '?': std::cerr << progname() << ": " << _("Unrecognized option") << " -" << static_cast<char>(optopt) << "\n"; rc = 1; break; default: std::cerr << progname() << ": " << _("getopt returned unexpected character code") << " " << std::hex << opt << "\n"; rc = 1; break; } return rc; } // Params::option
int Params::option(int opt, const std::string& optarg, int optopt) { int rc = 0; switch (opt) { case 'h': help_ = true; break; case 'V': version_ = true; break; case 'v': verbose_ = true; break; case 'k': preserve_ = true; break; case 'b': binary_ = false; break; case 'u': unknown_ = true; break; case 'f': force_ = true; fileExistsPolicy_ = overwritePolicy; break; case 'F': force_ = true; fileExistsPolicy_ = renamePolicy; break; case 'r': rc = evalRename(opt, optarg); break; case 't': rc = evalRename(opt, optarg); break; case 'T': rc = evalRename(opt, optarg); break; case 'a': rc = evalAdjust(optarg); break; case 'p': rc = evalPrint(optarg); break; case 'P': rc = evalPrintCols(optarg); break; case 'd': rc = evalDelete(optarg); break; case 'e': rc = evalExtract(optarg); break; case 'i': rc = evalInsert(optarg); break; case 'c': rc = evalModify(opt, optarg); break; case 'm': rc = evalModify(opt, optarg); break; case 'M': rc = evalModify(opt, optarg); break; case 'l': directory_ = optarg; break; case 'S': suffix_ = optarg; break; case ':': std::cerr << progname() << ": " << _("Option") << " -" << static_cast<char>(optopt) << " " << _("requires an argument\n"); rc = 1; break; case '?': std::cerr << progname() << ": " << _("Unrecognized option") << " -" << static_cast<char>(optopt) << "\n"; rc = 1; break; default: std::cerr << progname() << ": " << _("getopt returned unexpected character code") << " " << std::hex << opt << "\n"; rc = 1; break; } return rc; } // Params::option