From a4e78916b7050d4bbc24279e15cad03f2ac600b8 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 30 Oct 2018 13:44:46 -0700 Subject: [PATCH] pvtools: update options message --- pvtoolsSrc/pvcall.cpp | 15 ++++----------- pvtoolsSrc/pvget.cpp | 24 +++++++++++------------- pvtoolsSrc/pvput.cpp | 11 +---------- pvtoolsSrc/pvutils.h | 12 ++++++++++++ 4 files changed, 28 insertions(+), 34 deletions(-) diff --git a/pvtoolsSrc/pvcall.cpp b/pvtoolsSrc/pvcall.cpp index 9b3d012..c654a70 100644 --- a/pvtoolsSrc/pvcall.cpp +++ b/pvtoolsSrc/pvcall.cpp @@ -26,18 +26,11 @@ namespace { void callusage (void) { - fprintf (stderr, "\nUsage: " EXECNAME " [options] [=]...\n\n" - "\noptions:\n" - " -h: Help: Print this message\n" - " -V: Print version and exit\n" + fprintf (stderr, "\nUsage: " EXECNAME " [options] [=]...\n" + "\n" + COMMON_OPTIONS " -s : legacy form of PV name\n" - " -a : legacy form of argument\n" - " -r : Request, specifies what fields to return and options, default is '%s'\n" - " -w : Wait time, specifies timeout, default is %f seconds for get, inf. for monitor\n" - " -p : Set default provider name, default is '%s'\n" - " -M : Output mode. default is 'nt'\n" - " -v: Show entire structure (implies Raw mode)\n" - " -d: Enable debug output\n" + " -a : legacy form of argument\n" " deprecated options:\n" " -q, -t, -i, -n, -F: ignored\n" " -f : errors\n" diff --git a/pvtoolsSrc/pvget.cpp b/pvtoolsSrc/pvget.cpp index 71ef543..2b475d5 100644 --- a/pvtoolsSrc/pvget.cpp +++ b/pvtoolsSrc/pvget.cpp @@ -43,21 +43,19 @@ int haderror; void usage (void) { - fprintf (stderr, "\nUsage: " EXECNAME " [options] ...\n\n" - "\noptions:\n" - " -h: Help: Print this message\n" - " -V: Print version and exit\n" - " -r : Request, specifies what fields to return and options, default is '%s'\n" - " -w : Wait time, specifies timeout, default is %f seconds for get, inf. for monitor\n" - " -m: Monitor mode\n" - " -p : Set default provider name, default is '%s'\n" - " -M : Output mode. default is 'nt'\n" - " -v: Show entire structure (implies Raw mode)\n" - " -d: Enable debug output\n" + fprintf (stderr, "\nUsage: " EXECNAME " [options] ...\n" + "\n" + COMMON_OPTIONS " deprecated options:\n" " -q, -t, -i, -n, -F: ignored\n" " -f : errors\n" - "\nexample: " EXECNAME " double01\n\n" + " Output details:\n" + " -m -v: Monitor in Raw mode. Print only fields marked as changed.\n" + " -m -vv: Monitor in Raw mode. Highlight fields marked as changed, show all valid fields.\n" + " -m -vvv: Monitor in Raw mode. Highlight fields marked as changed, show all fields.\n" + " -vv: Get in Raw mode. Highlight valid fields, show all fields.\n" + "\n" + "example: " EXECNAME " double01\n\n" , request.c_str(), timeout, defaultProvider.c_str()); } @@ -365,7 +363,7 @@ int MAIN (int argc, char *argv[]) if(monitor) timeout = -1; - if(verbosity>0) + if(verbosity>0 && outmode==pvd::PVStructure::Formatter::NT) outmode = pvd::PVStructure::Formatter::Raw; pvd::PVStructure::shared_pointer pvRequest; diff --git a/pvtoolsSrc/pvput.cpp b/pvtoolsSrc/pvput.cpp index 9c876b1..1a09c2c 100644 --- a/pvtoolsSrc/pvput.cpp +++ b/pvtoolsSrc/pvput.cpp @@ -50,16 +50,7 @@ void usage (bool details=false) #endif fprintf (stderr, "\n" - "\noptions:\n" - " -h: Help: Print this message\n" - " -v: Print version and exit\n" - " -r : Request, specifies what fields to return and options, default is '%s'\n" - " -w : Wait time, specifies timeout, default is %f second(s)\n" - " -p : Set default provider name, default is '%s'\n" - " -M : Output mode. default is 'nt'\n" - " -v: Show entire structure (implies Raw mode)\n" - " -q: Quiet mode, print only error messages\n" - " -d: Enable debug output\n" + COMMON_OPTIONS " Deprecated options:\n" " default: Auto - try value as enum string, then as index number\n" " -n, -s, -F, -t: ignored\n" diff --git a/pvtoolsSrc/pvutils.h b/pvtoolsSrc/pvutils.h index b84183b..3eea594 100644 --- a/pvtoolsSrc/pvutils.h +++ b/pvtoolsSrc/pvutils.h @@ -22,6 +22,17 @@ typedef epicsGuardRelease UnGuard; namespace pvd = epics::pvData; namespace pva = epics::pvAccess; +#define COMMON_OPTIONS \ + "options:\n" \ + " -h: Help: Print this message\n" \ + " -V: Print version and exit\n" \ + " -r : Request, specifies what fields to return and options, default is '%s'\n" \ + " -w : Wait time, specifies timeout, default is %f second(s)\n" \ + " -p : Set default provider name, default is '%s'\n" \ + " -M : Output mode. default is 'nt'\n" \ + " -v: Show entire structure (implies Raw mode)\n" \ + " -q: Quiet mode, print only error messages\n" \ + " -d: Enable debug output\n" extern double timeout; extern bool debugFlag; @@ -58,6 +69,7 @@ struct Tracker { } static void prepare(); + EPICS_NOT_COPYABLE(Tracker) }; void jarray(pvd::shared_vector& out, const char *inp);