pva-tools: added quiet option, compact ouput of a table, transpose vs terse
This commit is contained in:
@@ -537,6 +537,7 @@ void usage (void)
|
||||
" -r <pv request>: Request, specifies what fields to return and options, default is '%s'\n"
|
||||
" -w <sec>: Wait time, specifies timeout, default is %f second(s)\n"
|
||||
" -t: Terse mode - print only successfully written value, without names\n"
|
||||
" -q: Quiet mode, print only error messages\n"
|
||||
" -d: Enable debug output\n"
|
||||
" -F <ofs>: Use <ofs> as an alternate output field separator"
|
||||
"\nExample: pvput double01 1.234\n\n"
|
||||
@@ -775,10 +776,11 @@ int main (int argc, char *argv[])
|
||||
{
|
||||
int opt; /* getopt() current option */
|
||||
bool debug = false;
|
||||
bool quiet = false;
|
||||
|
||||
setvbuf(stdout,NULL,_IOLBF,BUFSIZ); /* Set stdout to line buffering */
|
||||
|
||||
while ((opt = getopt(argc, argv, ":hr:w:tdF:")) != -1) {
|
||||
while ((opt = getopt(argc, argv, ":hr:w:tqdF:")) != -1) {
|
||||
switch (opt) {
|
||||
case 'h': /* Print usage */
|
||||
usage();
|
||||
@@ -802,6 +804,9 @@ int main (int argc, char *argv[])
|
||||
case 'd': /* Debug log level */
|
||||
debug = true;
|
||||
break;
|
||||
case 'q': /* Quiet mode */
|
||||
quiet = true;
|
||||
break;
|
||||
case 'F': /* Store this for output formatting */
|
||||
fieldSeparator = (char) *optarg;
|
||||
break;
|
||||
@@ -866,19 +871,19 @@ int main (int argc, char *argv[])
|
||||
do
|
||||
{
|
||||
// first connect
|
||||
shared_ptr<ChannelRequesterImpl> channelRequesterImpl(new ChannelRequesterImpl());
|
||||
shared_ptr<ChannelRequesterImpl> channelRequesterImpl(new ChannelRequesterImpl(quiet));
|
||||
Channel::shared_pointer channel = provider->createChannel(pvName, channelRequesterImpl);
|
||||
|
||||
if (channelRequesterImpl->waitUntilConnected(timeOut))
|
||||
{
|
||||
shared_ptr<ChannelPutRequesterImpl> putRequesterImpl(new ChannelPutRequesterImpl(channel->getChannelName()));
|
||||
if (mode != TerseMode)
|
||||
if (mode != TerseMode && !quiet)
|
||||
std::cout << "Old : ";
|
||||
ChannelPut::shared_pointer channelPut = channel->createChannelPut(putRequesterImpl, pvRequest);
|
||||
allOK &= putRequesterImpl->waitUntilDone(timeOut);
|
||||
if (allOK)
|
||||
{
|
||||
if (mode != TerseMode)
|
||||
if (mode != TerseMode && !quiet)
|
||||
printValue(pvName, putRequesterImpl->getStructure());
|
||||
|
||||
// convert value from string
|
||||
@@ -896,11 +901,11 @@ int main (int argc, char *argv[])
|
||||
if (allOK)
|
||||
{
|
||||
// and than a get again to verify put
|
||||
if (mode != TerseMode) std::cout << "New : ";
|
||||
if (mode != TerseMode && !quiet) std::cout << "New : ";
|
||||
putRequesterImpl->resetEvent();
|
||||
channelPut->get();
|
||||
allOK &= putRequesterImpl->waitUntilDone(timeOut);
|
||||
if (allOK)
|
||||
if (allOK && !quiet)
|
||||
printValue(pvName, putRequesterImpl->getStructure());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user