int isleader(char *inFile) { int isLeader = 0; int trailer; ceos_metadata_ext_t ceos_meta_type; char **metaName=NULL; ceos_meta_type = get_ceos_metadata_name(inFile, &metaName, &trailer); if (ceos_meta_type != NO_CEOS_METADATA) { isLeader = 1; } return isLeader; }
int isCEOS(const char *dataFile, char **error) { char **inBandName = NULL, **inMetaName = NULL, tmp[1024], *message = NULL; char baseName[512]; int ret = TRUE, nBands, trailer; ceos_metadata_ext_t metadata_ext; ceos_data_ext_t data_ext; if (strlen(dataFile) <= 0) return FALSE; char *dirName = (char *) MALLOC(sizeof(char)*1024); char *fileName = (char *) MALLOC(sizeof(char)*1024); split_dir_and_file(dataFile, dirName, fileName); metadata_ext = get_ceos_metadata_name(dataFile, &inMetaName, &trailer); data_ext = get_ceos_data_name(dataFile, baseName, &inBandName, &nBands); if (data_ext == NO_CEOS_DATA) { message = (char *) MALLOC(sizeof(char)*1024); strcpy(message, ""); sprintf(tmp, "Data file%s of original data (%s) missing.\n", (nBands>1) ? "s" : "", fileName); strcat(message, tmp); ret = FALSE; } if (metadata_ext == NO_CEOS_METADATA) { if (!message) { message = (char *) MALLOC(sizeof(char)*1024); strcpy(message, ""); } sprintf(tmp, "Metadata file of original data (%s) missing.\n", fileName); strcat(message, tmp); ret = FALSE; } *error = message; FREE(dirName); FREE(fileName); free_ceos_names(inBandName, inMetaName); return ret; }