added version to pvaTools

closes #35
This commit is contained in:
Matej Sekoranja
2016-03-22 11:55:59 +01:00
parent cce2a6c4b7
commit 43811e2511
5 changed files with 64 additions and 9 deletions

View File

@ -1030,6 +1030,7 @@ 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"
" -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"
@ -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)
{

View File

@ -50,7 +50,8 @@ void usage (void)
{
fprintf (stderr, "\nUsage: pvget [options] <PV name>...\n\n"
" -h: Help: Print this message\n"
"options:\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 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)
{

View File

@ -36,7 +36,8 @@ void usage (void)
{
fprintf (stderr, "\nUsage: pvinfo [options] <PV name>...\n\n"
" -h: Help: Print this message\n"
"options:\n"
" -v: Print version and exit\n"
"\noptions:\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,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)
{

View File

@ -446,7 +446,8 @@ void usage (void)
{
fprintf (stderr, "\nUsage: pvlist [options] [<server address or GUID starting with '0x'>]...\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 <sec>: 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)
{

View File

@ -280,7 +280,8 @@ void usage (void)
{
fprintf (stderr, "\nUsage: pvput [options] <PV name> <values>...\n\n"
" -h: Help: Print this message\n"
"options:\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"
@ -556,11 +557,21 @@ 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, ":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)
{