diff --git a/pvtoolsSrc/eget.cpp b/pvtoolsSrc/eget.cpp index 340dac7..d1d1e56 100644 --- a/pvtoolsSrc/eget.cpp +++ b/pvtoolsSrc/eget.cpp @@ -1030,6 +1030,7 @@ void usage (void) { fprintf (stderr, "\nUsage: eget [options] [... | -s ]\n\n" " -h: Help: Print this message\n" + " -v: Print version and exit\n" "\noptions:\n" " -s : Service API compliant based RPC service name (accepts NTURI request argument)\n" " -a : Service argument in 'name[=value]' or 'name value' form\n" @@ -1468,11 +1469,21 @@ int main (int argc, char *argv[]) setvbuf(stdout,NULL,_IOLBF,BUFSIZ); /* Set stdout to line buffering */ - while ((opt = getopt(argc, argv, ":hr: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 */ + { + Version version("eget", "cpp", + EPICS_PVA_MAJOR_VERSION, + EPICS_PVA_MINOR_VERSION, + EPICS_PVA_MAINTENANCE_VERSION, + EPICS_PVA_DEVELOPMENT_FLAG); + fprintf(stdout, "%s\n", version.getVersionString().c_str()); + return 0; + } case 'w': /* Set PVA timeout value */ if((epicsScanDouble(optarg, &timeOut)) != 1 || timeOut <= 0.0) { diff --git a/pvtoolsSrc/pvget.cpp b/pvtoolsSrc/pvget.cpp index 1f25166..76eb632 100644 --- a/pvtoolsSrc/pvget.cpp +++ b/pvtoolsSrc/pvget.cpp @@ -50,7 +50,8 @@ void usage (void) { fprintf (stderr, "\nUsage: pvget [options] ...\n\n" " -h: Help: Print this message\n" - "options:\n" + " -v: Print version and exit\n" + "\noptions:\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" " -t: Terse mode - print only value, without names\n" @@ -382,11 +383,21 @@ int main (int argc, char *argv[]) setvbuf(stdout,NULL,_IOLBF,BUFSIZ); /* Set stdout to line buffering */ - while ((opt = getopt(argc, argv, ":hr:w:tmp:qdcF:f:ni")) != -1) { + while ((opt = getopt(argc, argv, ":hvr:w:tmp:qdcF:f:ni")) != -1) { switch (opt) { case 'h': /* Print usage */ usage(); return 0; + case 'v': /* Print version */ + { + Version version("pvget", "cpp", + EPICS_PVA_MAJOR_VERSION, + EPICS_PVA_MINOR_VERSION, + EPICS_PVA_MAINTENANCE_VERSION, + EPICS_PVA_DEVELOPMENT_FLAG); + fprintf(stdout, "%s\n", version.getVersionString().c_str()); + return 0; + } case 'w': /* Set PVA timeout value */ if((epicsScanDouble(optarg, &timeOut)) != 1 || timeOut <= 0.0) { diff --git a/pvtoolsSrc/pvinfo.cpp b/pvtoolsSrc/pvinfo.cpp index 498cc94..46cefea 100644 --- a/pvtoolsSrc/pvinfo.cpp +++ b/pvtoolsSrc/pvinfo.cpp @@ -36,7 +36,8 @@ void usage (void) { fprintf (stderr, "\nUsage: pvinfo [options] ...\n\n" " -h: Help: Print this message\n" - "options:\n" + " -v: Print version and exit\n" + "\noptions:\n" " -w : Wait time, specifies timeout, default is %f second(s)\n" " -p : Set default provider name, default is '%s'\n" " -d: Enable debug output\n" @@ -70,11 +71,21 @@ int main (int argc, char *argv[]) setvbuf(stdout,NULL,_IOLBF,BUFSIZ); /* Set stdout to line buffering */ - while ((opt = getopt(argc, argv, ":hw: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 */ + { + Version version("pvinfo", "cpp", + EPICS_PVA_MAJOR_VERSION, + EPICS_PVA_MINOR_VERSION, + EPICS_PVA_MAINTENANCE_VERSION, + EPICS_PVA_DEVELOPMENT_FLAG); + fprintf(stdout, "%s\n", version.getVersionString().c_str()); + return 0; + } case 'w': /* Set PVA timeout value */ if((epicsScanDouble(optarg, &timeOut)) != 1 || timeOut <= 0.0) { diff --git a/pvtoolsSrc/pvlist.cpp b/pvtoolsSrc/pvlist.cpp index 0483b32..057bd3b 100644 --- a/pvtoolsSrc/pvlist.cpp +++ b/pvtoolsSrc/pvlist.cpp @@ -446,7 +446,8 @@ void usage (void) { fprintf (stderr, "\nUsage: pvlist [options] []...\n\n" " -h: Help: Print this message\n" - "options:\n" + " -v: Print version and exit\n" + "\noptions:\n" " -i Print server info (when server address list/GUID is given)\n" " -w : Wait time, specifies timeout, default is %f second(s)\n" " -q: Quiet mode, print only error messages\n" @@ -493,11 +494,21 @@ int main (int argc, char *argv[]) */ setvbuf(stdout,NULL,_IOLBF,BUFSIZ); /* Set stdout to line buffering */ - while ((opt = getopt(argc, argv, ":hw: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 */ + { + Version version("pvlist", "cpp", + EPICS_PVA_MAJOR_VERSION, + EPICS_PVA_MINOR_VERSION, + EPICS_PVA_MAINTENANCE_VERSION, + EPICS_PVA_DEVELOPMENT_FLAG); + fprintf(stdout, "%s\n", version.getVersionString().c_str()); + return 0; + } case 'w': /* Set PVA timeout value */ if((epicsScanDouble(optarg, &timeOut)) != 1 || timeOut <= 0.0) { diff --git a/pvtoolsSrc/pvput.cpp b/pvtoolsSrc/pvput.cpp index a74987f..15e5b00 100644 --- a/pvtoolsSrc/pvput.cpp +++ b/pvtoolsSrc/pvput.cpp @@ -280,7 +280,8 @@ void usage (void) { fprintf (stderr, "\nUsage: pvput [options] ...\n\n" " -h: Help: Print this message\n" - "options:\n" + " -v: Print version and exit\n" + "\noptions:\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" " -t: Terse mode - print only successfully written value, without names\n" @@ -556,11 +557,21 @@ int main (int argc, char *argv[]) setvbuf(stdout,NULL,_IOLBF,BUFSIZ); /* Set stdout to line buffering */ putenv(const_cast("POSIXLY_CORRECT=")); /* Behave correct on GNU getopt systems; e.g. handle negative numbers */ - while ((opt = getopt(argc, argv, ":hr:w:tp:qdF:f:ns")) != -1) { + while ((opt = getopt(argc, argv, ":hvr:w:tp:qdF:f:ns")) != -1) { switch (opt) { case 'h': /* Print usage */ usage(); return 0; + case 'v': /* Print version */ + { + Version version("pvput", "cpp", + EPICS_PVA_MAJOR_VERSION, + EPICS_PVA_MINOR_VERSION, + EPICS_PVA_MAINTENANCE_VERSION, + EPICS_PVA_DEVELOPMENT_FLAG); + fprintf(stdout, "%s\n", version.getVersionString().c_str()); + return 0; + } case 'w': /* Set PVA timeout value */ if((epicsScanDouble(optarg, &timeOut)) != 1 || timeOut <= 0.0) {