pvtools: make -V show version, -v show full structure

This commit is contained in:
Michael Davidsaver
2017-10-06 14:36:27 +02:00
parent 393ac72785
commit 2a1ba9418e
5 changed files with 27 additions and 19 deletions

View File

@ -1028,9 +1028,9 @@ string request(DEFAULT_REQUEST);
void usage (void)
{
fprintf (stderr, "\nUsage: eget [options] [<PV name>... | -s <service name>]\n\n"
" -h: Help: Print this message\n"
" -v: Print version and exit\n"
"\noptions:\n"
" -h: Help: Print this message\n"
" -V: Print version and exit\n"
" -s <service name>: Service API compliant based RPC service name (accepts NTURI request argument)\n"
" -a <service arg>: Service argument in 'name[=value]' or 'name value' form\n"
" -r <pv request>: Get request string, specifies what fields to return and options, default is '%s'\n"
@ -1459,12 +1459,12 @@ int main (int argc, char *argv[])
setvbuf(stdout,NULL,_IOLBF,BUFSIZ); /* Set stdout to line buffering */
while ((opt = getopt(argc, argv, ":hvr:s:a:w:zNtTmxp:qdcF:f:ni")) != -1) {
while ((opt = getopt(argc, argv, ":hVr:s:a:w:zNtTmxp:qdcF:f:ni")) != -1) {
switch (opt) {
case 'h': /* Print usage */
usage();
return 0;
case 'v': /* Print version */
case 'V': /* Print version */
{
Version version("eget", "cpp",
EPICS_PVA_MAJOR_VERSION,

View File

@ -53,15 +53,16 @@ char fieldSeparator = ' ';
void usage (void)
{
fprintf (stderr, "\nUsage: pvget [options] <PV name>...\n\n"
" -h: Help: Print this message\n"
" -v: Print version and exit\n"
"\noptions:\n"
" -h: Help: Print this message\n"
" -V: Print version and exit\n"
" -r <pv request>: Request, specifies what fields to return and options, default is '%s'\n"
" -w <sec>: Wait time, specifies timeout, default is 3 seconds for get, inf. for monitor\n"
" -t: Terse mode - print only value, without names\n"
" -i: Do not format standard types (enum_t, time_t, ...)\n"
" -m: Monitor mode\n"
" -p <provider>: Set default provider name, default is '%s'\n"
" -v: Show entire structure\n"
" -q: Quiet mode, print only error messages\n"
" -d: Enable debug output\n"
" -F <ofs>: Use <ofs> as an alternate output field separator\n"
@ -365,12 +366,15 @@ int main (int argc, char *argv[])
// ================ Parse Arguments
while ((opt = getopt(argc, argv, ":hvRr:w:tmp:qdcF:f:ni")) != -1) {
while ((opt = getopt(argc, argv, ":hvVRr:w:tmp:qdcF:f:ni")) != -1) {
switch (opt) {
case 'h': /* Print usage */
usage();
return 0;
case 'v': /* Print version */
case 'v':
mode = StructureMode;
break;
case 'V': /* Print version */
{
Version version("pvget", "cpp",
EPICS_PVA_MAJOR_VERSION,

View File

@ -34,9 +34,9 @@ const string noAddress;
void usage (void)
{
fprintf (stderr, "\nUsage: pvinfo [options] <PV name>...\n\n"
" -h: Help: Print this message\n"
" -v: Print version and exit\n"
"\noptions:\n"
" -h: Help: Print this message\n"
" -V: Print version and exit\n"
" -w <sec>: Wait time, specifies timeout, default is %f second(s)\n"
" -p <provider>: Set default provider name, default is '%s'\n"
" -d: Enable debug output\n"
@ -70,12 +70,12 @@ int main (int argc, char *argv[])
setvbuf(stdout,NULL,_IOLBF,BUFSIZ); /* Set stdout to line buffering */
while ((opt = getopt(argc, argv, ":hvw:p:dc")) != -1) {
while ((opt = getopt(argc, argv, ":hVw:p:dc")) != -1) {
switch (opt) {
case 'h': /* Print usage */
usage();
return 0;
case 'v': /* Print version */
case 'V': /* Print version */
{
Version version("pvinfo", "cpp",
EPICS_PVA_MAJOR_VERSION,

View File

@ -449,9 +449,9 @@ bool discoverServers(double timeOut)
void usage (void)
{
fprintf (stderr, "\nUsage: pvlist [options] [<server address or GUID starting with '0x'>]...\n\n"
" -h: Help: Print this message\n"
" -v: Print version and exit\n"
"\noptions:\n"
" -h: Help: Print this message\n"
" -V: Print version and exit\n"
" -i Print server info (when server address list/GUID is given)\n"
" -w <sec>: Wait time, specifies timeout, default is %f second(s)\n"
" -q: Quiet mode, print only error messages\n"
@ -498,12 +498,12 @@ int main (int argc, char *argv[])
*/
setvbuf(stdout,NULL,_IOLBF,BUFSIZ); /* Set stdout to line buffering */
while ((opt = getopt(argc, argv, ":hvw:qdF:f:i")) != -1) {
while ((opt = getopt(argc, argv, ":hVw:qdF:f:i")) != -1) {
switch (opt) {
case 'h': /* Print usage */
usage();
return 0;
case 'v': /* Print version */
case 'V': /* Print version */
{
Version version("pvlist", "cpp",
EPICS_PVA_MAJOR_VERSION,

View File

@ -68,13 +68,14 @@ void usage (bool details=false)
#endif
fprintf (stderr,
"\n"
"\noptions:\n"
" -h: Help: Print this message\n"
" -v: Print version and exit\n"
"\noptions:\n"
" -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"
" -p <provider>: Set default provider name, default is '%s'\n"
" -v: Show entire structure\n"
" -q: Quiet mode, print only error messages\n"
" -d: Enable debug output\n"
" -F <ofs>: Use <ofs> as an alternate output field separator\n"
@ -406,12 +407,15 @@ int main (int argc, char *argv[])
setvbuf(stdout,NULL,_IOLBF,BUFSIZ); /* Set stdout to line buffering */
putenv(const_cast<char*>("POSIXLY_CORRECT=")); /* Behave correct on GNU getopt systems; e.g. handle negative numbers */
while ((opt = getopt(argc, argv, ":hvr:w:tp:qdF:f:ns")) != -1) {
while ((opt = getopt(argc, argv, ":hvVr:w:tp:qdF:f:ns")) != -1) {
switch (opt) {
case 'h': /* Print usage */
usage(true);
return 0;
case 'v': /* Print version */
case 'v':
mode = StructureMode;
break;
case 'V': /* Print version */
{
Version version("pvput", "cpp",
EPICS_PVA_MAJOR_VERSION,