Changeset 23268 for trunk/psModules/src/config/pmConfigRun.c
- Timestamp:
- Mar 11, 2009, 10:54:22 AM (17 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/config/pmConfigRun.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/config/pmConfigRun.c
r23259 r23268 71 71 } 72 72 73 psArray *pmConfigRunFileGet(pmConfig *config, const char *name) 74 { 75 PS_ASSERT_PTR_NON_NULL(config, false); 76 PS_ASSERT_STRING_NON_EMPTY(name, false); 77 78 psMetadata *run = configRun(config);// RUN information 79 psAssert(run, "Require run-time information"); 80 psMetadata *files = configElement(run, "FILES", "Filerules used during execution"); 81 psAssert(files, "Require list of files"); 82 83 psList *list = psListAlloc(NULL); // List of file names 84 85 psString regex = NULL; // Regular expression for iteration 86 psStringAppend(®ex, "^%s$", name); 87 psMetadataIterator *iter = psMetadataIteratorAlloc(files, PS_LIST_HEAD, regex); 88 psFree(regex); 89 psMetadataItem *item; // Item from iteration 90 while ((item = psMetadataGetAndIncrement(iter))) { 91 psAssert(item->type == PS_DATA_STRING, "We only put STRING types here."); 92 psListAdd(list, PS_LIST_TAIL, item->data.str); 93 } 94 psFree(iter); 95 96 if (psListLength(list) == 0) { 97 // Didn't find anything 98 psFree(list); 99 return NULL; 100 } 101 102 psArray *array = psListToArray(list); // Array of file names, to return 103 psFree(list); 104 105 return array; 106 } 107 73 108 74 109 bool pmConfigRunCommand(pmConfig *config, int argc, char **argv)
Note:
See TracChangeset
for help on using the changeset viewer.
