Changeset 10421 for trunk/psModules/src/config/pmConfig.c
- Timestamp:
- Dec 3, 2006, 8:48:10 AM (19 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/config/pmConfig.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/config/pmConfig.c
r9992 r10421 4 4 * @author EAM (IfA) 5 5 * 6 * @version $Revision: 1.5 4$ $Name: not supported by cvs2svn $7 * @date $Date: 2006-1 1-15 02:34:18$6 * @version $Revision: 1.55 $ $Name: not supported by cvs2svn $ 7 * @date $Date: 2006-12-03 18:48:10 $ 8 8 * 9 9 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 454 454 455 455 456 // XXX aren't these (return false) below errors: call psError? 456 457 bool pmConfigValidateCameraFormat(const psMetadata *cameraFormat, const psMetadata *header) 457 458 { … … 463 464 psMetadata *rule = psMetadataLookupMetadata(&mdStatus, cameraFormat, "RULE"); 464 465 if (! mdStatus || ! rule) { 465 ps LogMsg(__func__, PS_LOG_WARN, "Unable to read rule for camera.\n");466 psError(PS_ERR_UNKNOWN, true, "Unable to read rule for camera.\n"); 466 467 return false; 467 468 } … … 472 473 while ((ruleItem = psMetadataGetAndIncrement(ruleIter))) { 473 474 // Check for the existence of the rule 474 psMetadataItem *headerItem = psMetadataLookup( (psMetadata*)header, ruleItem->name);475 psMetadataItem *headerItem = psMetadataLookup(header, ruleItem->name); 475 476 if (! headerItem) { 476 477 // It doesn't have a required header keyword, so it's not it 477 478 psFree(ruleIter); 478 ps Trace("psModules.config", 5, "Can't find %s\n", ruleItem->name);479 psError(PS_ERR_UNKNOWN, true, "Can't find %s\n", ruleItem->name); 479 480 return false; 480 481 } … … 482 483 // Check to see if the rule works 483 484 if (! psMetadataItemCompare(headerItem, ruleItem)) { 484 ps Trace("psModules.config", 5, "%s doesn't match.\n", ruleItem->name);485 psError(PS_ERR_UNKNOWN, true, "%s doesn't match.\n", ruleItem->name); 485 486 psFree(ruleIter); 486 487 return false; … … 938 939 glob (words->data[i], 0, NULL, &globList); 939 940 941 // if the glob does not match, save the literal word: 942 // otherwise save all glob matches 940 943 if (globList.gl_pathc == 0) { 941 psError(PS_ERR_IO, true, "No match for %s", (char *)words->data[i]); 942 return input; 943 } 944 945 for (int j = 0; j < globList.gl_pathc; j++) { 946 char *filename = psStringCopy (globList.gl_pathv[j]); 947 psArrayAdd (input, 16, filename); 948 psFree (filename); 944 psArrayAdd (input, 16, words->data[i]); 945 } else { 946 for (int j = 0; j < globList.gl_pathc; j++) { 947 char *filename = psStringCopy (globList.gl_pathv[j]); 948 psArrayAdd (input, 16, filename); 949 psFree (filename); 950 } 949 951 } 950 952 } … … 1008 1010 return true; 1009 1011 } 1012 1013 // convert the supplied name, create a new output psString 1014 psString pmConfigConvertFilename (char *filename, pmConfig *config) 1015 { 1016 1017 psString newName = psStringCopy (filename); 1018 1019 // strip file:// from front of name 1020 if (!strncasecmp (newName, "file://", strlen("file://"))) { 1021 newName = psStringSubstitute (newName, "", "file://"); 1022 } 1023 1024 // replace path://PATH with matched datapath 1025 if (!strncasecmp (newName, "path://", strlen("path://"))) { 1026 // filename should be of the form: path://PATH/rest/of/file 1027 // replace PATH with matching name from config->site:DATAPATH 1028 psMetadata *datapath = psMetadataLookupPtr (NULL, config->site, "DATAPATH"); 1029 if (datapath == NULL) { 1030 psError(PS_ERR_UNKNOWN, true, "DATAPATH is not defined in config.site"); 1031 psFree (newName); 1032 return NULL; 1033 } 1034 1035 char *point = newName + strlen("path://"); 1036 char *mark = strchr (point, '/'); 1037 if (mark == NULL) { 1038 psError(PS_ERR_UNKNOWN, true, "syntax error in PATH-style name %s", newName); 1039 psFree (newName); 1040 return false; 1041 } 1042 1043 psString path = psStringNCopy (point, mark - point); 1044 char *realpath = psMetadataLookupStr (NULL, datapath, path); 1045 if (realpath == NULL) { 1046 psError(PS_ERR_UNKNOWN, true, "path (%s) not defined in config.site:DATAPATH for PATH-style name %s", path, newName); 1047 psFree (newName); 1048 psFree (path); 1049 return false; 1050 } 1051 psFree (path); 1052 1053 char *tmpName = NULL; 1054 psStringAppend (&tmpName, "%s/%s", realpath, mark + 1); 1055 psFree (newName); 1056 newName = tmpName; 1057 } 1058 1059 // substitute neb://name with matched nebulous name 1060 1061 // if we still have a relative path, prepend WORKDIR: 1062 if (newName[0] != '/') { 1063 char *workdir = psMetadataLookupStr (NULL, config->site, "WORKDIR"); 1064 if (workdir) { 1065 psStringPrepend (&newName, "%s/", workdir); 1066 } 1067 } 1068 1069 return newName; 1070 }
Note:
See TracChangeset
for help on using the changeset viewer.
