00001 00026 #include "drms.h" 00027 #include "drms_names.h" 00028 #include "jsoc_main.h" 00029 00030 ModuleArgs_t module_args[] = { 00031 {ARG_INT, "getdir", "0"}, 00032 {} 00033 }; 00034 00035 char *module_name = "drms_query"; 00037 int DoIt (void) { 00038 int i, j, status, getdir; 00039 DRMS_RecordSet_t *rs; 00040 DRMS_Record_t *rec; 00041 char *rsname, dirname[DRMS_MAXPATHLEN]; 00042 00043 getdir = cmdparams_get_int (&cmdparams, "getdir", NULL); 00044 i = 1; 00045 while ((rsname = cmdparams_getarg (&cmdparams,i++))) { 00046 rs = drms_open_records (drms_env, rsname, &status); 00047 if (!status) { 00048 for (j=0; j<rs->n; j++) { 00049 rec = rs->records[j]; 00050 if (drms_record_numsegments (rec) && getdir) { 00051 drms_record_directory (rec, dirname, 1); 00052 printf ("%s[:#%lld] sudir=%s\n", rec->seriesinfo->seriesname, 00053 rec->recnum,dirname); 00054 } else 00055 printf ("%s[:#%lld]\n", rec->seriesinfo->seriesname, rec->recnum); 00056 } 00057 drms_close_records (rs, DRMS_FREE_RECORD); 00058 } else 00059 printf ("drms_open_records failed with error code %d.\n", status); 00060 } 00061 return 0; 00062 }