-Xm~MAKESFDU10-DIST.BCKMAKESFDU10-DIST.BCKYBACKUP/NOLOG/INTERCHANGE MAKESFDU.C,MAKESFDULINK.COM,ADI.TXT MAKESFDU10-DIST.BCK/SAVE_SET BURLEY  E5(V6.1 _NSSDCA:: 2 _$1$DUB54: V6.1 ~ '*[BURLEY.MAKESFDU]MAKESFDU.C;12+,6.3/ 4Q32-@.0123KPWO4569(7@|(89GHJ"/* Sabrina Sowers *//* Started: June 17, 1993 */L/* Generate a minimal, detached SFDU file for any ISTP formatted CDF file */L/* Modifications: */L/* K. Horrocks 5/25/95 ; Enhance to be able to read both R and Z vars */L/* R. Burley 5/31/95 ; Get Generation date from sys clock not data */L/* ; REFERENCE portion bounded by () not '' */L/* R. Burley 6/28/95 ; Each line should be followed by both a line- */L/* ; feed AND a carriage return. The byte lengths */L/* ; of the R-label and CIO-label should not include*/L/* ; their own lengths but SHOULD include the LF+CR */L/* ; following it. The CIO stop time has been fixed*/L/* ; from 'END' time to 'STOP' time */#include #include #include #include #include M/****************************************************************************M************************ GENERATION DATE FUNCTION ***************************M****************************************************************************/C/* This function extracts the generation date from the global scopeH attribute "Logical_file_id". NOTE: The date extracted from the idD is an approximation and may not be the exact generation date */Dint get_gen_date (char *string, FILE *fp, int p_to_file, char *okay){9 char str[11]; /* String to hold the formatted date */? char hold_date[9]; /* String to hold the unformatted date */E char *no_date="0000-00-00"; /* Used if an ivalid Logical_file_id */@ char *k; /* Pointer to the string with the generation date */ char *flag="F"; /* Flag */N int i=0, j=0, size=0; /* Loop control variables/indices and gen_date size */ k = string;A /* Increment address in k until at date or null encountered */& for (i=0; string[i] != '\0'; i++) {  if (string[i] == '_') j++; k++; if (j==3) break; }H /* If the generation date does not exist, print default date to file1 or the size of the date -- Sabrina Sowers */ if (string[i] == '\0') {3 *okay = *flag; /* Set okay flag to false */F if (p_to_file) fprintf (fp, "Generation Date = %s;\r\n", no_date);7 else { size = strlen(no_date) + 21; return(size); } } else {J for (i=0; k[i] != '_'; i++) hold_date[i] = k[i]; /* Get the date */8 hold_date[i] = '\0'; /* Insert null character */8 /* Put date in generation date format: yyyy-mm-dd */. for (i=0; i<4; i++) str[i] = hold_date[i]; str[i] = '-';. for ( ; i<6; i++) str[i+1] = hold_date[i]; str[i+1] = '-';? for ( ; hold_date[i] != '\0'; i++) str[i+2] = hold_date[i];0 str[i+2] = '\0'; /* Insert null character */B if (p_to_file) fprintf (fp, "Generation Date = %s;\r\n", str);3 else { size = strlen(str) + 21; return(size); } } return(size);}H/**********************************************************************/H/* Generate a YYYY-mm-dd date string based on system clock time */H/**********************************************************************/Eint get_gen_date2 (char *string, FILE *fp, int p_to_file, char *okay){ time_t current_time; struct tm *ptrtime; char datestr[12]=""; int size=0;H time(¤t_time); /* get time from sys clock */H ptrtime = localtime(¤t_time); /* breakdown to y m d */H strftime(datestr,11,"%Y-%m-%d",ptrtime); /* format for output */A if (p_to_file) fprintf(fp,"Generation Date = %s;\r\n",datestr); else size=strlen(datestr)+21; return(size);}M/****************************************************************************M************************ ERROR STATUS HANDLER *******************************M****************************************************************************/0/* This function handles the CDF status codes */void error (CDFstatus status){& char message [CDF_STATUSTEXT_LEN+1]; if (status < CDF_WARN) {J CDFerror(status, message); /* A halting error has occurred */' printf("ATTENTION> %s\n", message); exit(status); } else if (status < CDF_OK) {J CDFerror(status, message); /* Function may not have completed correctly */) printf("ATTENTION> %s\n", message); exit(1); } else if (status > CDF_OK) {L CDFerror(status, message); /* Function completed, but something$ incorrect has occured */+ printf("ATTENTION> %s\n", message); exit(1); }return;}M/****************************************************************************M************************ GLOBAL ATTRIBUTE FUNCTION **************************M****************************************************************************/J/* This function gets the necessary global scope attributes and reads and # writes their values to file */Eint get_glob_attr (CDFid id, char *attrName, FILE *fp, int p_to_file, char *okay){2 CDFstatus status; /* Returned status code */& long entryN; /* Entry number */- long numelems; /* Number of elements */; int glob_size=0; /* Global attribute size in bytes */3 int g_date_size=0; /* Generation date size */' char *buffer; /* Buffer space */ entryN = 0;( /* Check for attribute existence */$ status = CDFlib(SELECT_, CDF_, id,0 ATTR_NAME_, attrName, gENTRY_, entryN,& GET_, gENTRY_NUMELEMS_, &numelems, NULL_); if (status < CDF_OK) {/ if (status != NO_SUCH_ENTRY) error(status); } else {H buffer = (char *) malloc (numelems + 1); /* Allocate buffer space */N if (buffer == NULL) printf ("Buffer for information is not allocated.\n"); /* Get attribute value */& status = CDFlib(SELECT_, CDF_, id,2 ATTR_NAME_, attrName, gENTRY_, entryN,! GET_, gENTRY_DATA_, buffer, NULL_);( if (status != CDF_OK) error(status); else {F buffer[numelems] = '\0'; /* Insert null character into buffer */K /* If p_to_file is true, compare attribute name to comparison string.G If no match occurs, print to file. Otherwise, print the generation# date to file -- Sabrina Sowers */ if (p_to_file) {4 if ((strcmp(attrName, "Logical_file_id"))) {2 if (!(strcmp(attrName, "Data_version"))); fprintf (fp, "%s = %s;\r\n", attrName, buffer);B else fprintf (fp, "%s = \"%s\";\r\n", attrName, buffer); }? else g_date_size = get_gen_date2(buffer, fp, p_to_file, okay); free(buffer); }C /* If p_to_file is false, compare attribute name to comparison> string. If match occurs, get the generation date size and) return the global attribute size */ else {5 if (!(strcmp(attrName, "Logical_file_id"))) {< g_date_size = get_gen_date2(buffer, fp, p_to_file, okay); free(buffer); return(g_date_size); } else {2 if (!(strcmp(attrName, "Data_version")))> glob_size = strlen(attrName) + strlen(buffer) + 6;A else glob_size = strlen(attrName) + strlen(buffer) + 8; free(buffer); return(glob_size); } }  } } return(glob_size);}M/****************************************************************************M************************ EPOCH VARIABLE FUNCTION ****************************M****************************************************************************/H/* This function will read the Epoch rVariable from the current CDF file and decipher the value */5int get_epoch_var (CDFid id, char *varName, FILE *fp, int p_to_file){3 CDFstatus status; /* Returned status code */7 long maxRec; /* Maximum record for rVariable */* long varNum; /* Variable number */( long recNum; /* Record number *// long indices[2]; /* Dimension indices */3 long year, month, day, hour; /* For dates */ long minute, second, msec;' double value; /* rVariable value */6 int date_size=0; /* Size in bytes dates take up */ indices[0]=0; indices[1]=0;K/* If p_to_file is true, get the start and end dates. Otherwise return the date_size -- Sabrina Sowers */ if (p_to_file) {' status = CDFlib(SELECT_, "CDF_, id,2 zVAR_NAME_, varName,, GET_, zVAR_NUMBER_, varName, &varNum,# zVAR_MAXREC_, &maxRec, NULL_);) if (status != CDF_OK) error(status); else {L /* Check if CDF skeleton exists. If so, set dates to zero. Otherwise& get the start and end date */ if (maxRec == -1) {N fprintf (fp, "Start_date = %04d-%02d-%02dT%02d:%02d:%02d.%03dZ;\r\n", 0,0,0,0,0,0,0);M fprintf (fp, "Stop_date = %04d-%02d-%02dT%02d:%02d:%02d.%03dZ;\r\n", 0,0,0,0,0,0,0); } else {- /* Get the value of the first record */ recNum = 0;$ status = CDFlib(SELECT_, CDF_, id,0 zVAR_, varNum,% zVAR_RECNUMBER_, recNum,' zVAR_DIMINDICES_, indices, GET_, zVAR_DATA_, &value, NULL_);- if (status != CDF_OK) error(status);A else { /* Decipher the variable value into date */G EPOCHbreakdown(value, &year, &month, &day, &hour, &minute, &second, &msec);P fprintf (fp, "Start_date = %d-%02d-%02dT%02d:%02d:%02d.%03dZ;\r\n",4 year, month, day, hour, minute, second, msec); }/ /* Get the value of the last record */ recNum = maxRec;+ status = CDFlib(SELECT_, CDF_, id,0 zVAR_, varNum,: zVAR_RECNUMBER_, recNum,< zVAR_DIMINDICES_, indices,2 GET_, zVAR_DATA_, &value, NULL_);- if (status != CDF_OK) error(status);? else { /* Decipher the variable value into date */E EPOCHbreakdown(value, &year, &month, &day, &hour, &minute, &second, &msec);M fprintf (fp, "Stop_date = %d-%02d-%02dT%02d:%02d:%02d.%03dZ;\r\n",5 year, month, day, hour, minute, second, msec); } } } } else { date_size = 79; return(date_size); } return(date_size);}M/****************************************************************************M************************ CONTENTS IDENTIFIER OBJECT *************************M****************************************************************************/;int get_CIO (CDFid id, FILE *fp, int p_to_file, char *okay){2 CDFstatus status; /* Returned status code */8 int CIOsize=0; /* Contents Identifier Object size */: char attrName[CDF_ATTR_NAME_LEN+1]; /* Attribute name */7 char varName[CDF_VAR_NAME_LEN+1]; /* Variable Name */= long attrNum; /* Attribute Number*/; long varNum; /* Variable Name */* long numelems; /* Number of elements */G /* Acquire the necessary global scope attributes -- Sabrina Sowers */& status = CDFlib(SELECT_, CDF_, id,% ATTR_NAME_, "Project",/ GET_, ATTR_NAME_, attrName, NULL_); if (status != CDF_OK) {I printf ("\nERROR> Unable to find global attribute \"Project\".\n");C printf ("CDF file is not ISTP formatted. Please modify.\n"); error(status); }? CIOsize = get_glob_attr(id, attrName, fp, p_to_file, okay);& status = CDFlib(SELECT_, CDF_, id,6 ATTR_NAME_, "Discipline",/ GET_, ATTR_NAME_, attrName, NULL_); if (status != CDF_OK) {L printf ("\nERROR> Unable to find global attribute \"Discipline\".\n");C printf ("CDF file is not ISTP formatted. Please modify.\n"); error(status); }@ CIOsize += get_glob_attr(id, attrName, fp, p_to_file, okay);& status = CDFlib(SELECT_, CDF_, id,7 ATTR_NAME_, "Source_name",/ GET_, ATTR_NAME_, attrName, NULL_); if (status != CDF_OK) {M printf ("\nERROR> Unable to find global attribute \"Source_name\".\n");C printf ("CDF file is not ISTP formatted. Please modify.\n"); error(status); }@ CIOsize += get_glob_attr(id, attrName, fp, p_to_file, okay);& status = CDFlib(SELECT_, CDF_, id,5 ATTR_NAME_, "Data_type",/ GET_, ATTR_NAME_, attrName, NULL_); if (status != CDF_OK) {K printf ("\nERROR> Unable to find global attribute \"Data_type\".\n");C printf ("CDF file is not ISTP formatted. Please modify.\n"); error(status); }@ CIOsize += get_glob_attr(id, attrName, fp, p_to_file, okay);& status = CDFlib(SELECT_, CDF_, id,6 ATTR_NAME_, "Descriptor",/ GET_, ATTR_NAME_, attrName, NULL_); if (status != CDF_OK) {L printf ("\nERROR> Unable to find global attribute \"Descriptor\".\n");C printf ("CDF file is not ISTP formatted. Please modify.\n"); error(status); }@ CIOsize += get_glob_attr(id, attrName, fp, p_to_file, okay);A /* Acquire the start and stop dates from the Epoch rVariable */& status = CDFlib(SELECT_, CDF_, id,1 zVAR_NAME_, "Epoch",. GET_, zVAR_NAME_, varName, NULL_); if (status != CDF_OK) {@ printf ("\nERROR> Unable to find rVariable \"Epoch\".\n");C printf ("CDF file is not ISTP formatted. Please modify.\n"); error(status); }: CIOsize += get_epoch_var (id, varName, fp, p_to_file); /* Acquire the data version */& status = CDFlib(SELECT_, CDF_, id,8 ATTR_NAME_, "Data_version",/ GET_, ATTR_NAME_, attrName, NULL_); if (status != CDF_OK) {N printf ("\nERROR> Unable to find global attribute \"Data_version\".\n");C printf ("CDF file is not ISTP formatted. Please modify.\n"); error(status); }@ CIOsize += get_glob_attr(id, attrName, fp, p_to_file, okay); /* Acquire the Generation DateN NOTE: The date is extracted from the Logical_file_id. This is not neces-G sarily the actually data generation date. It does not exist in the+ CDF file and is optional information */& status = CDFlib(SELECT_, CDF_, id,; ATTR_NAME_, "Logical_file_id",/ GET_, ATTR_NAME_, attrName, NULL_); if (status != CDF_OK) {Q printf ("\nERROR> Unable to find global attribute \"Logical_file_id\".\n");C printf ("CDF file is not ISTP formatted. Please modify.\n"); error(status); }@ CIOsize += get_glob_attr(id, attrName, fp, p_to_file, okay); return(CIOsize);}M/****************************************************************************M************************ REFERENCE LABEL OBJECT *****************************M****************************************************************************/@int get_ref_label (CDFid id, char *CDFname, FILE *fp, FILE *adi,! int p_to_file, char *okay){/ CDFstatus status; /* Returned status code */E char *str; /* Pointer to adjusted CDFfilename */: char *ConAuth="NSSD"; /* Control authority (default) */C char *ACAI="0000"; /* Assigned Control Authority id (default) */* char *mission; /* Mission identifier */" char *datatype; /* Data type */! char *descr; /* Descriptor */$ char *buffer; /* Buffer space */A char *MI, *DS, *DT, *CA, *AI; /* Buffers for file search */@ char *T1, *T2, *T3; /* Buffers for file search */, int i, j, k; /* Loop control variables */* int refsize; /* Reference label size */# int success=0; /* Success flag */) long numelems; /* Number of elements */* long entryno=0; /* entry number */H str = CDFname; /* Str points to the CDFfilename supplied by user */ i = 0;@ /* Check for device or node names in the CDFfilename. Chop off that portion of the string */" while (i != (strlen(CDFname))) { if (str[0] == ':') { str++; break; } else { str++; i++; } }* if (i==(strlen(CDFname))) str = CDFname; else { i=0; while (i != strlen(str)) {N if ((str[i] == '[') || (str[i] == '.') || (str[i] == ']')) str[i] = '/'; if (str[i] == ']') break; i++; } }H /* If p_to_file is true and valid Logical_file_id, get the reference) label contents -- Sabrina Sowers */+ if ((p_to_file) && (strcmp(okay, "F"))) { #+ /* Check if Logical_file_id exists */& status = CDFlib(SELECT_, CDF_, id,; ATTR_NAME_, "Logical_file_id", gENTRY_, entryno,( GET_, gENTRY_NUMELEMS_, &numelems, NULL_); if (status < CDF_OK) {1 if (status != NO_SUCH_ENTRY) error(status); } else {J buffer = (char *) malloc (numelems + 1); /* Allocate buffer space */P if (buffer == NULL) printf ("Buffer for information is not allocated.\n"); /* Get attribute value */( status = CDFlib(SELECT_, CDF_, id,= ATTR_NAME_, "Logical_file_id"," gENTRY_, entryno,# GET_, gENTRY_DATA_, buffer, NULL_);* if (status != CDF_OK) error(status); else {H buffer[numelems] = '\0'; /* Insert null character into buffer */9 mission = malloc (6); /* Allocate memory space */ datatype = malloc (6); descr = malloc (6);L /* Get the mission, datatype and descriptor from the Logical_file_id */( for (i=0; buffer[i] != '_'; i++)! mission[i] = buffer[i]; mission[i] = '\0';, for (j=0; buffer[i+j+1] != '_'; j++)& datatype[j] = buffer[i+j+1]; datatype[j] = '\0';= /* Descriptor is currently a maximum of 4 letters. That is a0 restriction adhered to in its extraction */. for (k=0; buffer[i+j+k+2] != '_'; k++)% descr[k] = buffer[i+j+k+2]; if (k==3) { descr[k] = ' '; descr[k+1] = '\0'; } else descr[k] = '\0';F /* Allocate memory for the file search. This is restricted to the* current format of the ADI.TXT file */: MI = malloc (4); DS = malloc (6); DT = malloc (4);= T1 = malloc (17); T2 = malloc (20); T3 = malloc (25);) AI = malloc (6); CA = malloc (6);K i = 0; j = 0; k = 0; /* Reinitialize the loop control variables */J /* Search for the existence of mission, datatype and descriptor whileA not end of file adi.txt and success is false. If they exist,: get the Control Authority and Assigned Control Authority Identification */ do {= fgets(MI, 3, adi); /* Get mission from file */O if (!(strcmp(MI, mission))) { /* If comparison, get descriptor */= if (fgetc(adi) ==EOF) printf("ADI FILE FORMAT ERROR\n");C fgets(DS, 5, adi); /* Get descriptor from file */M if (!(strcmp(DS, descr))) { /* If comparison, get datatype */? if (fgetc(adi) ==EOF) printf("ADI FILE FORMAT ERROR\n");A fgets(DT, 3, adi); /* Get datatype from file */O if (!(strcmp(DT, datatype))) { /* If comparison, get ACAI, CA */: if (fgetc(adi) ==EOF) printf("ADI FILE FORMAT ERROR\n");> fgets(CA, 5, adi); /* Get Control Authority */ ConAuth = CA;E fgets(AI, 5, adi); /* Get the Control Authority Id */ ACAI = AI;8 success = 1; /* Set success flag to true */ }A else fgets(T1, 16, adi); /* Read to end of line */ }> else fgets(T2, 19, adi); /* Read to end of line */ }< else fgets(T3, 24, adi); /* Read to end of line */3 } while ((!(feof(adi))) && (!(success==1)));- /* Write the information to file */ = fprintf (fp, "%s\r\n", "REFERENCETYPE = ($CCSDS2);");K fprintf (fp, "%s%s%s%s%s%s\r\n", "LABEL = ", ConAuth, "3IF0", ACAI, "00000001", ";");? fprintf (fp, "%s%s%s\r\n", "REFERENCE = (", str, ");"); } }& /* Free allocated memory space */A free(DT); free(T1); free(T2); free(T3); free(AI); free(MI);I free(DS); free(mission); free(datatype); free(descr); free(buffer); }A /* If p_to_file is true and invalid Logical_file_id, print the default information to file */+ if ((p_to_file) && (strcmp(okay, "T"))) {; fprintf (fp, "%s%c\r\n", "REFERENCETYPE = ($CCSDS2);");G fprintf (fp, "%s%s%s%s%s%s\r\n", "LABEL = ", ConAuth, "3IF0", ACAI, "00000001", ";");; fprintf (fp, "%s%s%s\r\n", "REFERENCE = (", str, ");"); } else {? refsize = 26 + 8 + strlen(ConAuth) + 4 + strlen(ACAI) + 9 + 15 + strlen(str) + 6; return(refsize); } return(refsize);}M/****************************************************************************M******************************** MAIN PROGRAM *******************************M****************************************************************************/main (int argc, char *argv[]){- FILE *fp, *adi; /* file pointers */) CDFid id; /* CDF identifier */- CDFstatus status; /* Status code */7 int CIOsize=0; /* Contents Identifier Object size */, int REFsize=0; /* Reference Label size */, int p_to_file=0; /* Print to file flag */@ int Z_label=0, R_label=0, K_label=0; /* SFDU label sizes */ char *okay="T"; /* Flag */ int nCDFs,i,wild; char **dirS; char **CDFs; char CDFname[80] = ""; char SFDUname[80] = "";< /* Check if correct number of arguments on command line */ if (argc != 4) {K printf ("\nIncorrect number of parameters entered on command line.\n"); printf ("Need to enter:\n");G printf ("makesfdu istp::sys$public:[sfdu_tools.bld_sfdu]adi.txt ");* printf ("CDFfilename SFDUfilename\n"); exit(1); }3 strcpy(CDFname,argv[2]); /* copy CDF file name */5 strcpy(SFDUname,argv[3]); /* copy SFDU file name */: /* Check for single SFDU construction or for wildcard */ if (strcmp(CDFname,"*")==0) {3 nCDFs = CDFdirList ("*", &dirS, &CDFs); wild=1; } else { nCDFs = 1; wild=0; }$ /* For all SFDU's to be created */ for (i=0; i printf ("\nError opening SFDU file '%s'\n", SFDUname); exit(1); } p_to_file = 0;1 CIOsize = get_CIO(id, fp, p_to_file, okay);E REFsize = get_ref_label(id, CDFname, fp, adi, p_to_file, okay); p_to_file = 1; R_label = REFsize + 2; K_label = CIOsize + 2;, Z_label = 20 + 20 + K_label + R_label;6 fprintf (fp, "%s%08d", "CCSD1Z000001", Z_label);: fprintf (fp, "%s%08d\r\n", "NSSD1K000060", K_label);1 CIOsize = get_CIO(id, fp, p_to_file, okay);: fprintf (fp, "%s%08d\r\n", "CCSD1R000003", R_label);E REFsize = get_ref_label(id, CDFname, fp, adi, p_to_file, okay); }& status = CDFlib(SELECT_, CDF_, id,! CLOSE_, CDF_,4 NULL_); /* close the CDF file */' if (status < CDF_OK) error(status);) fclose(fp); /* close the SFDU file */' } /* for all SFDUs to be generated */9 fclose(adi); /* Close the represntative ADI.TXT file */}E~MAKESFDU10-DIST.BCK. @.#[BURLEY.MAKESFDU]MAKESFDULINK.COM;10#*[BURLEY.MAKESFDU]MAKESFDULINK.COM;1+,. ./ 40-@.0123KPWO56 t׼7cl89/jGHJ($CDFDIR = F$EXTRACT(0,F$LENGTH(P1)-1,P1)0$cc/noopt/include='CDFDIR'.SRC.INCLUDE] makesfdu$link makesfdu,-# 'CDFDIR'.src.tools]toolbox1,-# 'CDFDIR'.src.tools]toolbox3,-! 'CDFDIR'.src.lib]libcdf/liby0~MAKESFDU10-DIST.BCK/F@.[BURLEY.MAKESFDU]ADI.TXT;1*[BURLEY.MAKESFDU]ADI.TXT;1+,/F./ 4-@.0123KPWO56R7 89/jGHJ GE NUL CH NSSD0065GE NUL SD NSSD0075GE DEF OR NSSD0092GE PRE OR NSSD0092GE LNG OR NSSD0092GE DEF AT NSSD0093GE PRE AT NSSD0093GE PWI LZ NSSD0076GE HEP LZ NSSD0077GE MGF LZ NSSD0078GE LEP LZ NSSD0079GE EFD LZ NSSD0080GE EPI LZ NSSD0081GE CPI LZ NSSD0082GE SCR LZ NSSD0083GE QAF LZ NSSD0084GE PWI QL NSSD0076GE HEP QL NSSD0077GE MGF QL NSSD0078GE LEP QL NSSD0079GE EFD QL NSSD0080GE EPI QL NSSD0081GE CPI QL NSSD0082GE SCR QL NSSD0083GE QAF QL NSSD0084 GE PWI K0 NSSD0085GE HPB K0 NSSD0000GE HPL K0 NSSD0086GE MGF K0 NSSD0087GE LEP K0 NSSD0088GE EFD K0 NSSD0089GE EPI K0 NSSD0090GE CPI K0 NSSD0091WI NUL CH NSSD0000WI DEF OR NSSD0092WI PRE OR NSSD0092WI LNG OR NSSD0092WI DEF AT NSSD0093WI PDE AT NSSD0093WI WAV LZ NSSD0000WI EPA LZ NSSD0000WI MFI LZ NSSD0000WI SWE LZ NSSD0000WI SIC LZ NSSD0000WI 3DP LZ NSSD0000WI TGR LZ NSSD0000WI KON LZ NSSD0000WI SCR LZ NSSD0000WI WAV K0 NSSD0000 WI EPA K0 NSSD0000WI MFI K0 NSSD0000WI SWE K0 NSSD0000WI SIC K0 NSSD0000WI 3DP K0 NSSD0000WI TGR K0 NSSD0000WI KON K0 NSSD0000PO NUL CH NSSD0000PO DEF OR NSSD0092PO PRE OR NSSD0092PO LNG OR NSSD0092PO DEF AT NSSD0093PO PRE AT NSSD0093PO PWI LZ NSSD0000PO HYD LZ NSSD0000PO MFE LZ NSSD0000PO TIM LZ NSSD0000PO UVI LZ NSSD0000PO VIS LZ NSSD0000PO PIX LZ NSSD0000PO CAM LZ NSSD0000PO CEP LZ NSSD0000PO TID LZ NSSD0000PO EFI LZ NSSD0000PO SCR LZ NSSD0000PO QAF LZ NSSD0000PO PWI K0 NSSD0000PO HYD K0 NSSD0000PO MFE K0 NSSD0000PO TIM K0 NSSD0000PO UVI K0 NSSD0000PO VIS K0 NSSD0000PO PIX K0 NSSD0000PO CAN K0 NSSD0000PO CEP K0 NSSD0000PO TID K0 NSSD0000PO EFI K0 NSSD0000DN GBAY K0 NSSD0104DN PACE K0 NSSD0105DN SCHF K0 NSSD0000DN STR K0 NSSD0106DN SABR K0 NSSD0107DN BARS K0 NSSD0108SE VLF K0 NSSD0101SN GSIR K0 NSSD0102CN ASI K0 NSSD0103CN BARS K0 NSSD0000CN MARI K0 NSSD0000CN MPA K0 NSSD0000 I8 MAG LZ NSSD0000I8 PLA LZ NSSD0000I8 MCE OR NSSD0000I8 MAG K0 NSSD0094I8 PLA K0 NSSD0095G6 MAG K0 NSSD0096G6 EPS K0 NSSD0097G7 MAG K0 NSSD0096G7 EPS K0 NSSD0097G8 MAG K0 NSSD0096G8 EP8 K0 NSSD0098G9 MAG K0 NSSD0096G9 EP8 K0 NSSD0098L9 MPA K0 NSSD0099L9 SPA K0 NSSD0100L0 MPA K0 NSSD0099L0 SPA K0 NSSD0100L1 MPA K0 NSSD0099L1 SPA K0 NSSD0100o ~MAKESFDU10-DIST.BCKh 9 kn}INK.COM;1&Ȼ*MAKESFDU10-DIST.BON[kR/>0 tZ-f#QDQELm`z)M@OA|hEDB IudGPPTlXzK,G_,AUI.TYTMAKSFDU10+DdS(lCK)QlfYGT=0CUNEl  ! K2PjJ,OW5GD>. n]IrKay 9cH&D]B <:= /\)&9 hk BG l7Js]E Ntr y`'uG35 T.X=U,0VD-P?{_wEqG;uo M"gcSdS|]oqj}>3+D*o4 2ySCi nderM/861VyLbl.+Id'K02u;~f0"$3`drLo-,}w+_]J9t|k+hOfe "ools{d&՗=37I&+W\mXx ,jEMgn9lz yb4abiH,tIER?z aNSkkEaat"!cpUN)zysu *< EycEN)(A:6s%]Q]i~a+i5$2AC$?Dne^]lv !*Rp6'Yts5+B]VBtvdgde6IL4l aSkzXdzf.&A9.)NSklnssd 3 gelepqlnssd 3 geefdqlnssd 3 mjlEcklh!!!+S[K &/upzeiq N&2='UL] qeg$B?&rTOq>E/7s&_DPR)! a0AR"lny|0r')Qu5)E)wi~|jqGvtgE&50AT"_Nn720UVBo~ 4 wi E ornssd 3 wilngoi(66 qwv r 4(R6,'GEa&E:&!*ghv 50T5d)EN& H=ssn|9*3 wiwavlznssd 3;w&Fe$)EwL/16(Q^T PIdL,$,L?2O;?7d^_Di}c;LO;3N)s:0dhq ow2"OPkDI#6s,QCREvnw/I=5% 0dssd 3 wimfiknshdVB_] 4E s#,MEkDOnt`tzm2isicknssd/EIZ*3LU/Ur ' Y_X>t N7+'DEk S:7?-RXt N(#;DEk S:!:*WXs&N-99DEctT'>6jX0 0i>,L1!#,6F`;mD0}9*9*ze zxo ex dyyn*9*ze fdm ex dyyn*9*ze nol k~ dyyn*9*ze zxo T dyyn*9*ze z}c fp ds~ubqTZOod fc *9*ze glo fp dyyn*9O ~cg fp dyyn*9*ze |c fp dyyn*9*ze |cy fp dyyn*9*ze zcr fp d|SD0s0*3T8&Sc'8NC83O s6;T'<=dTQDU ur?" !!G 5B/?s7S_@U[poefiA8.R'1&0U|oti3.L %;LE3Dl}s du Gh5oD05#E4.R/0'!TVBo~ $'Ep>-d Bns:7Q^acp" X!4%TI$^/=7d]QIn|tp-Em2-E.HA-'s#U^UBagi?!0(9Ea NS-^DWeg_7*N 2(TEkC&2!dCDBi}g|of -@ n:=0@oDoLf9#E|i;HA9 !82=10K*poC+ <S?B{b999*3S$=I-"pTOkXO"7s0XUVoam1;T1-dDA?Ud|S{0Shrrp'O)"DA?U{whM9Sgr- Gg6.yH$\Dn';!D^Roam%:T5%c!A?Ud|S0VhrrddN<,'T. ~cct0#"GytSE/I(s2*XFWlzddO4(!3LVI"6 -TSdnC* s )G|yd`^YVtvrs1Ov8.E8DR'=4dGXDY gh6nG"=, A?YO s7%DT/cnC)2; -\A)nq 9*3F//Gbk} kI 's- j.0onS$;7tp9ds+_@Soxt1!Lm& RI*RL+ |-^TYSlz)rn-G(/DA8?=:)!0iKpqaST>3N)hS0/9 VC?&(EN;rA*7!!CCYn3kiMN9(+A?D/'6d_BZuli]N3#4NT.BE*syk09 uo5$|w8DR'=4Ym=3'~p: b[nMSd^f3(4CR$/ {Isst\+8;O7epsK ` 4NssdY_(y=z m#5EA #Nss9009~3 gopqF?XEn46*UBXLi|ng]A9$gDO.C <'dUHPEt? 7KI+$DE-QU"'s QD\t| *PL(aA)k!!s0XUJiielVFs$)E/QT+s~ibQRrzn-s"'$RSkNISdY_(`t>YN4 (}v iccK3 l "; Yv (?2# 9 3/fs6$aOK*I(?2#E_false */F if (p_to_file) fprintf (fp, "Generation Date = %s;\r\n", no_date);7 else { size = strlen(no_date) + 21; return(size); } } else {J for (i=0; k[i] != '_'; i++) hold_date[i] = k[i]; /* Get the date */8 hold_date[i] = '\0'; /* Insert null character */8 /* Put date in generation date format: yyyy-mm-dd */. for (i=0; i<4; i++) str[i] = hold_date[i]; str[i] = '-';. for ( ; i<6; i++) str[i+1] = hold_date[i]; str[i+1] = '-';? for O; hold_date[i] != '\0'; i++) str[i+2] = hold_date[i];0 str[i+2] = '\0'; /* Insert null character */B if (p_to_file) fprintf (fp, "Generation Date = %s;\r\n", str);3 else { size = strlen(str) + 21; return(size); } } return(size);}H/**********************************************************************/H/* Generate a YYYY-mm-dd date string based on system clock time */H/**********************************************************************/Eint get_gen_date2 (char *string, FILE *fp, int p_to_file, char *okay){ time_t current_time; struct tm *ptrtime; char datestr[12]=""; int size=0;H time(¤t_time); /* get time from sys clock */H ptrtime = localtime(¤t_time); /* breakdown to y m d */H strftime(datestr,11,"%Y-%m-%d",ptrtime); /* format for output */A if (p_to_file) fprintf(fp,"Generation Date = %s;\r\n",datestr); else size=strlen(datestr)+21; return(size);}M/****************************************************************************M************************ ERROR STATUS HANDLER *******************************M****************************************************************************/0/* This function handles the CDF status codes */void error (CDFstatus status){& char message [CDF_STATUSTEXT_LEN+1]; if (status < CDF_WARN) {J CDFerror(status, message); /* A halting error has occurred */' printf("ATTENTION> %s\n", message); exit(status); } else if (status < CDF_OK) {J CDFerror(status, message); /* Function may not have completed correctly */) printf("ATTENTION> %s\n", message); exit(1); } else if (status > CDF_OK) {L CDFerror(status, message); /* Function completed, but something$ incorrect has occured */+ printf("ATTENTION> %s\n", message); exit(1); }return;}M/****************************************************************************M************************ GLOBAL ATTRIBUTE FUNCTION **************************M****************************************************************************/J/* This function gets the necessary global scope attributes and reads and # writes their values to file */Eint get_glob_attr (CDFid id, char *attrName, FILE *fp, int p_to_file, char *okay){2 CDFstatus status; /* Returned status code */& long entryN; /* Entry number */- long numelems; /* Number of elements */; int glob_size=0; /* Global attribute size in bytes */3 int g_date_size=0; /* Generation date size */' char *buffer; /* Buffer space */ entryN = 0;( /* Check for attribute existence */$ status = CDFlib(SELECT_, CDF_, id,0 ATTR_NAME_, attrName, gENTRY_, entryN,& GET_, gENTRY_NUMELEMS_, &numelems, NULL_); if (status < CDF_OK) {/ if (status != NO_SUCH_ENTRY) error(status); } else {H buffer = (char *) malloc (numelems + 1); /* Allocate buffer space */N if (buffer == NULL) printf ("Buffer for information is not allocated.\n"); /* Get attribute value */& status = CDFlib(SELECT_, CDF_, id,2 ATTR_NAME_, attrName, gENTRY_, entryN,! GET_, gENTRY_DATA_, buffer, NULL_);( if (status != CDF_OK) error(status); else {F buffer[numelems] = '\0'; /* Insert null character into buffer */K /* If p_to_file is true, compare attribute name to comparison string.G If no match occurs, print to file. Otherwise, print the generation# date to file -- Sabrina Sowers */ if (p_to_file) {4 if ((strcmp(attrName, "Logical_file_id"))) {2 if (!(strcmp(attrName, "Data_version"))); fprintf (fp, "%s = %s;\r\n", attrName, buffer);B else fprintf (fp, "%s = \"%s\";\r\n", attrName, buffer); }? else g_date_size = get_gen_date2(buffer, fp, p_to_file, okay); free(buffer); }C /* If p_to_file is false, compare attribute name to comparison> string. If match occurs, get the generation date size and) return the global attribute size */ else {5 if (!(strcmp(attrName, "Logical_file_id"))) {< g_date_size = get_gen_date2(buffer, fp, p_to_file, okay); free(buffer); return(g_date_size); } else {2 if (!(strcmp(attrName, "Data_version")))> glob_size = strlen(attrName) + strlen(buffer) + 6;A else glob_size = strlen(attrName) + strlen(buffer) + 8; free(buffer); return(glob_size); } }  } } return(glob_size);}M/****************************************************************************M************************ EPOCH VARIABLE FUNCTION ****************************M****************************************************************************/H/* This function will read the Epoch rVariable from the current CDF file and decipher the value */5int get_epoch_var (CDFid id, char *varName, FILE *fp, int p_to_file){3 CDFstatus status; /* Returned status code */7 long maxRec; /* Maximum record for rVariable */* long varNum; /* Variable number */( long recNum; /* Record number *// long indices[2]; /* Dimension indices */3 long year, month, day, hour; /* For dates */ long minute, second, msec;' double value; /* rVariable value */6 int date_size=0; /* Size in bytes dates take up */ indices[0]=0; indices[1]=0;K/* If p_to_file is true, get the start and end dates. Otherwise return the date_size -- Sabrina Sowers */ if (p_to_file) {' status = CDFlib(SELECT_, "CDF_, id,2 zVAR_NAME_, varName,, GET_, zVAR_NUMBER_, varName, &varNum,# zVAR_MAXREC_, &maxRec, NULL_);) if (status != CDF_OK) error(status); else {L /* Check if CDF skeleton exists. If so, set dates to zero. Otherwise& get the start and end date */ if (maxRec == -1) {N fprintf (fp, "Start_date = %04d-%02d-%02dT%02d:%02d:%02d.%03dZ;\r\n", 0,0,0,0,0,0,0);M fprintf (fp, "Stop_date = %04d-%02d-%02dT%02d:%02d:%02d.%03dZ;\r\n", 0,0,0,0,0,0,0); } else {- /* Get the value of the first record */ recNum = 0;$ status = CDFlib(SELECT_, CDF_, id,0 zVAR_, varNum,% zVAR_RECNUMBER_, recNum,' zVAR_DIMINDICES_, indices, GET_, zVAR_DATA_, &value, NULL_);- if (status != CDF_OK) error(status);A else { /* Decipher the variable value into date */G EPOCHbreakdown(value, &year, &month, &day, &hour, &minute, &second, &msec);P fprintf (fp, "Start_date = %d-%02d-%02dT%02d:%02d:%02d.%03dZ;\r\n",4 year, month, day, hour, minute, second, msec); }/ /* Get the value of the last record */ recNum = maxRec;+ status = CDFlib(SELECT_, CDF_, id,0 zVAR_, varNum,: zVAR_RECNUMBER_, recNum,< zVAR_DIMINDICES_, indices,2 GET_, zVAR_DATA_, &value, NULL_);- if (status != CDF_OK) error(status);? else { /* Decipher the variable value into date */E EPOCHbreakdown(value, &year, &month, &day, &hour, &minute, &second, &msec);M fprintf (fp, "Stop_date = %d-%02d-%02dT%02d:%02d:%02d.%03dZ;\r\n",5 year, month, day, hour, minute, second, msec); } } } } else { date_size = 79; return(date_size); } return(date_size);}M/****************************************************************************M************************ CONTENTS IDENTIFIER OBJECT *************************M****************************************************************************/;int get_CIO (CDFid id, FILE *fp, int p_to_file, char *okay){2 CDFstatus status; /* Returned status code */8 int CIOsize=0; /* Contents Identifier Object size */: char attrName[CDF_ATTR_NAME_LEN+1]; /* Attribute name */7 char varName[CDF_VAR_NAME_LEN+1]; /* Variable Name */= long attrNum; /* Attribute Number*/; long varNum; /* Variable Name */* long numelems; /* Number of elements */G /* Acquire the necessary global scope attributes -- Sabrina Sowers */& status = CDFlib(SELECT_, CDF_, id,% ATTR_NAME_, "Project",/ GET_, ATTR_NAME_, attrName, NULL_); if (status != CDF_OK) {I printf ("\nERROR> Unable to find global attribute \"Project\".\n");C printf ("CDF file is not ISTP formatted. Please modify.\n"); error(status); }? CIOsize = get_glob_attr(id, attrName, fp, p_to_file, okay);& status = CDFlib(SELECT_, CDF_, id,6 ATTR_NAME_, "Discipline",/ GET_, ATTR_NAME_, attrName, NULL_); if (status != CDF_OK) {L printf ("\nERROR> Unable to find global attribute \"Discipline\".\n");C printf ("CDF file is not ISTP formatted. Please modify.\n"); error(status); }@ CIOsize += get_glob_attr(id, attrName, fp, p_to_file, okay);& status = CDFlib(SELECT_, CDF_, id,7 ATTR_NAME_, "Source_name",/ GET_, ATTR_NAME_, attrName, NULL_); if (status != CDF_OK) {M printf ("\nERROR> Unable to find global attribute \"Source_name\".\n");C printf ("CDF file is not ISTP formatted. Please modify.\n"); error(status); }@ CIOsize += get_glob_attr(id, attrName, fp, p_to_file, okay);& status = CDFlib(SELECT_, CDF_, id,5 ATTR_NAME_, "Data_type",/ GET_, ATTR_NAME_, attrName, NULL_); if (status != CDF_OK) {K printf ("\nERROR> Unable to find global attribute \"Data_type\".\n");C printf ("CDF file is not ISTP formatted. Please modify.\n"); error(status); }@ CIOsize += get_glob_attr(id, attrName, fp, p_to_file, okay);& status = CDFlib(SELECT_, CDF_, id,6 ATTR_NAME_, "Descriptor",/ GET_, ATTR_NAME_, attrName, NULL_); if (status != CDF_OK) {L printf ("\nERROR> Unable to find global attribute \"Descriptor\".\n");C printf ("CDF file is not ISTP formatted. Please modify.\n"); error(status); }@ CIOsize += get_glob_attr(id, attrName, fp, p_to_file, okay);A /* Acquire the start and stop dates from the Epoch rVariable */& status = CDFlib(SELECT_, CDF_, id,1 zVAR_NAME_, "Epoch",. GET_, zVAR_NAME_, varName, NULL_); if (status != CDF_OK) {@ printf ("\nERROR> Unable to find rVariable \"Epoch\".\n");C printf ("CDF file is not ISTP formatted. Please modify.\n"); error(status); }: CIOsize += get_epoch_var (id, varName, fp, p_to_file); /* Acquire the data version */& status = CDFlib(SELECT_, CDF_, id,8 ATTR_NAME_, "Data_version",/ GET_, ATTR_NAME_, attrName, NULL_); if (status != CDF_OK) {N printf ("\nERROR> Unable to find global attribute \"Data_version\".\n");C printf ("CDF file is not ISTP formatted. Please modify.\n"); error(status); }@ CIOsize += get_glob_attr(id, attrName, fp, p_to_file, okay); /* Acquire the Generation DateN NOTE: The date is extracted from the Logical_file_id. This is not neces-G sarily the actually data generation date. It does not exist in the+ CDF file and is optional information */& status = CDFlib(SELECT_, CDF_, id,; ATTR_NAME_, "Logical_file_id",/ GET_, ATTR_NAME_, attrName, NULL_); if (status != CDF_OK) {Q printf ("\nERROR> Unable to find global attribute \"Logical_file_id\".\n");C printf ("CDF file is not ISTP formatted. Please modify.\n"); error(status); }@ CIOsize += get_glob_attr(id, attrName, fp, p_to_file, okay); return(CIOsize);}M/****************************************************************************M************************ REFERENCE LABEL OBJECT *****************************M****************************************************************************/@int get_ref_label (CDFid id, char *CDFname, FILE *fp, FILE *adi,! int p_to_file, char *okay){/ CDFstatus status; /* Returned status code */E char *str; /* Pointer to adjusted CDFfilename */: char *ConAuth="NSSD"; /* Control authority (default) */C char *ACAI="0000"; /* Assigned Control Authority id (default) */* char *mission; /* Mission identifier */" char *datatype; /* Data type */! char *descr; /* Descriptor */$ char *buffer; /* Buffer space */A char *MI, *DS, *DT, *CA, *AI; /* Buffers for file search */@ char *T1, *T2, *T3; /* Buffers for file search */, int i, j, k; /* Loop control variables */* int refsize; /* Reference label size */# int success=0; /* Success flag */) long numelems; /* Number of elements */* long entryno=0; /* entry number */H str = CDFname; /* Str points to the CDFfilename supplied by user */ i = 0;@ /* Check for device or node names in the CDFfilename. Chop off that portion of the string */" while (i != (strlen(CDFname))) { if (str[0] == ':') { str++; break; } else { str++; i++; } }* if (i==(strlen(CDFname))) str = CDFname; else { i=0; while (i != strlen(str)) {N if ((str[i]