/** * Copyright - See the COPYRIGHT that is included with this distribution. * pvxs is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. */ #include #include #include #include #include #include #include #include #include #include "utilpvt.h" using namespace pvxs; namespace { void usage(const char* argv0) { std::cerr<<"Usage: "< [ | = ...]\n" "\n" " -h Show this message.\n" " -V Print version and exit.\n" " -r pvRequest condition.\n" " -v Make more noise.\n" " -d Shorthand for $PVXS_LOG=\"pvxs.*=DEBUG\". Make a lot of noise.\n" " -w Operation timeout in seconds. default 5 sec.\n" ; } } int main(int argc, char *argv[]) { logger_config_env(); // from $PVXS_LOG double timeout = 5.0; bool verbose = false; std::string request; { int opt; while ((opt = getopt(argc, argv, "hvVdw:r:")) != -1) { switch(opt) { case 'h': usage(argv[0]); return 0; case 'V': std::cout< values; if(argc-optind==1 && std::string(argv[optind]).find_first_of('=')==std::string::npos) { // only one field assignment, and field name omitted. // implies .value values["value"] = argv[optind]; } else { for(auto n : range(optind, argc)) { std::string fv(argv[n]); auto sep = fv.find_first_of('='); if(sep==std::string::npos) { std::cerr<<"Error: expected = not \""< Value { auto val = std::move(prototype); for(auto& pair : values) { try{ val[pair.first] = pair.second; }catch(NoConvert& e){ throw std::runtime_error(SB()<<"Unable to assign "<