394 while ((opt =
getopt(argc, argv,
":taicnhsSVe:f:g:l:#:d:0:w:p:F:")) != -1) {
400 printf(
"\nEPICS Version %s, CA Protocol version %s\n", EPICS_VERSION_STRING,
ca_version() );
403 complainIfNotPlainAndSet(&format,
terse);
406 complainIfNotPlainAndSet(&format,
all);
414 if (sscanf(
optarg,
"%d", &type) != 1)
419 char str[30] =
"DBR_";
427 fprintf(
stderr,
"Requested dbr type out of range " 428 "or invalid - ignored. ('caget -h' for help.)\n");
438 fprintf(
stderr,
"'%s' is not a valid timeout value " 439 "- ignored. ('caget -h' for help.)\n",
optarg);
444 if (sscanf(
optarg,
"%d", &count) != 1)
446 fprintf(
stderr,
"'%s' is not a valid array element count " 447 "- ignored. ('caget -h' for help.)\n",
optarg);
454 fprintf(
stderr,
"'%s' is not a valid CA priority " 455 "- ignored. ('caget -h' for help.)\n",
optarg);
469 if (sscanf(
optarg,
"%d", &digits) != 1)
471 "Invalid precision argument '%s' " 472 "for option '-%c' - ignored.\n",
optarg, opt);
478 fprintf(
stderr,
"Precision %d for option '-%c' " 479 "out of range - ignored.\n", digits, opt);
485 case 'x': outType =
hex;
break;
486 case 'b': outType =
bin;
break;
487 case 'o': outType =
oct;
break;
490 fprintf(
stderr,
"Invalid argument '%s' " 491 "for option '-%c' - ignored.\n", optarg, opt);
493 if (outType !=
dec) {
507 "Unrecognized option: '-%c'. ('caget -h' for help.)\n",
512 "Option '-%c' requires an argument. ('caget -h' for help.)\n",
525 fprintf(
stderr,
"No pv name specified. ('caget -h' for help.)\n");
532 fprintf(
stderr,
"CA error %s occurred while trying " 533 "to start channel access.\n",
ca_message(result));
538 pvs = calloc (nPvs,
sizeof(
pv));
541 fprintf(
stderr,
"Memory allocation for channel structures failed.\n");
546 for (n = 0; optind < argc; n++, optind++)
547 pvs[n].name = argv[optind] ;
553 result =
caget(pvs, nPvs, request, format, type, count);
int getopt(int nargc, char *const *nargv, const char *ostr)
pvd::StructureConstPtr type
#define epicsScanDouble(str, to)
int epicsStdCall ca_context_create(ca_preemptive_callback_select premptiveCallbackSelect)
#define dbr_text_to_type(text, type)
int caget(pv *pvs, int nPvs, OutputT format, chtype dbrType, unsigned long reqElems)
const char *epicsStdCall ca_message(long ca_status)
const char *epicsStdCall ca_version()
#define VALID_DOUBLE_DIGITS
void epicsStdCall ca_context_destroy()