/* 1. Include appropriate files. */ #include #include /* EPICS specific */ #define USAGE "usage: ezee " int main(int argc, char **argv) { chid chan; dbr_string_t string; int status; if(argc != 2) { printf("%s\n", USAGE); exit(-1); } /* 2. Initialize Channel Access. */ status = ca_task_initialize(); SEVCHK(status, "Unable to initialize"); if (status != ECA_NORMAL) exit(-1); /* 3. Make search request. */ status = ca_search(argv[1], &chan); if (status != ECA_NORMAL) { printf("%s: problem establishing connection to %s.", ca_message(status), argv[1]); exit(-1); } /* 4. Send the request and wait for channel to be found. */ status = ca_pend_io(1.0); if (status != ECA_NORMAL) { printf("%s: Not Found\n", argv[1]); exit(-1); } /* 5. Make get request. */ status = ca_bget(chan, string); SEVCHK(status, "Error in call to ca_bget()" ); status = ca_pend_io(1.0); if (status != ECA_NORMAL) { printf("%s: Get Timed Out\n", argv[1]); exit(-1); } printf("%s\n", string); /* 6. Free resources and close channel access. */ ca_task_exit(); return(0); }