Changeset 12916 for trunk/psModules/src/config/pmConfigRecipes.c
- Timestamp:
- Apr 18, 2007, 4:10:12 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/config/pmConfigRecipes.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/config/pmConfigRecipes.c
r12890 r12916 51 51 52 52 // this function may be called several times. it attempts to load the recipe data from one of 53 // three locations: config->site, config->camera, and config->argv. We cannot read the recipes53 // three locations: config->site, config->camera, and argv. We cannot read the recipes 54 54 // from config->camera until a camera has been read BUT, the argv recipes must override the 55 55 // camera and site recipes. … … 124 124 125 125 // search for options of the form -D KEY VALUE or -D RECIPE:KEY VALUE 126 bool pmConfigLoadRecipeOptions ( pmConfig *config, char *flag)126 bool pmConfigLoadRecipeOptions (int *argc, char **argv, pmConfig *config, char *flag) 127 127 { 128 128 bool success; … … 140 140 141 141 // -D key value (all added as string) 142 while ((argNum = psArgumentGet (* config->argc, config->argv, flag))) {143 psArgumentRemove (argNum, config->argc, config->argv);142 while ((argNum = psArgumentGet (*argc, argv, flag))) { 143 psArgumentRemove (argNum, argc, argv); 144 144 145 145 // do we have enough arguments? 146 if (argNum + 1 >= * config->argc) {146 if (argNum + 1 >= *argc) { 147 147 psError(PS_ERR_IO, true, "insufficient parameters for command-line argument -D"); 148 148 return false; … … 152 152 const char *recipeName = NULL; 153 153 char *key; 154 psArray *words = psStringSplitArray( config->argv[argNum], ":", false);154 psArray *words = psStringSplitArray(argv[argNum], ":", false); 155 155 switch (words->n) { 156 156 case 1: … … 182 182 bool valid = false; 183 183 if (!strcmp (flag, "-D")) { 184 psMetadataAddStr (recipe, PS_LIST_TAIL, key, PS_META_REPLACE, "", config->argv[argNum+1]);184 psMetadataAddStr (recipe, PS_LIST_TAIL, key, PS_META_REPLACE, "", argv[argNum+1]); 185 185 valid = true; 186 186 } 187 187 if (!strcmp (flag, "-Di")) { 188 psMetadataAddS32 (recipe, PS_LIST_TAIL, key, PS_META_REPLACE, "", atoi( config->argv[argNum+1]));188 psMetadataAddS32 (recipe, PS_LIST_TAIL, key, PS_META_REPLACE, "", atoi(argv[argNum+1])); 189 189 valid = true; 190 190 } 191 191 if (!strcmp (flag, "-Df")) { 192 psMetadataAddF32 (recipe, PS_LIST_TAIL, key, PS_META_REPLACE, "", atof( config->argv[argNum+1]));192 psMetadataAddF32 (recipe, PS_LIST_TAIL, key, PS_META_REPLACE, "", atof(argv[argNum+1])); 193 193 valid = true; 194 194 } 195 195 if (!strcmp (flag, "-Db")) { 196 if (!strcasecmp ( config->argv[argNum+1], "true")) {196 if (!strcasecmp (argv[argNum+1], "true")) { 197 197 psMetadataAddBool (recipe, PS_LIST_TAIL, key, PS_META_REPLACE, "", true); 198 198 } else { … … 204 204 assert (valid); // flag may be: -D, -Df, -Di, -Db 205 205 206 psArgumentRemove (argNum, config->argc, config->argv);207 psArgumentRemove (argNum, config->argc, config->argv);206 psArgumentRemove (argNum, argc, argv); 207 psArgumentRemove (argNum, argc, argv); 208 208 } 209 209 return true; … … 214 214 // if VALUE is not an exiting file, it is a symbolic lookup: it is saved on config->recipeSymbols 215 215 // for later interpolation (pmConfigReadRecipes with option CL) 216 bool pmConfigLoadRecipeArguments ( pmConfig *config)216 bool pmConfigLoadRecipeArguments (int *argc, char **argv, pmConfig *config) 217 217 { 218 218 bool success; … … 228 228 // Go through the command-line arguments 229 229 int argNum; // Argument number for "-recipe" 230 while ((argNum = psArgumentGet(* config->argc, config->argv, "-recipe")) > 0) {231 psArgumentRemove(argNum, config->argc, config->argv);232 if (argNum + 1 >= * config->argc) {230 while ((argNum = psArgumentGet(*argc, argv, "-recipe")) > 0) { 231 psArgumentRemove(argNum, argc, argv); 232 if (argNum + 1 >= *argc) { 233 233 psError(PS_ERR_IO, false, "-recipe command-line switch provided without the required recipe and source\n"); 234 234 return false; 235 235 } 236 236 237 char *recipeName = psStringCopy( config->argv[argNum]); // Name of the recipe238 psArgumentRemove(argNum, config->argc, config->argv);239 char *recipeSource = psStringCopy( config->argv[argNum]); // Source of the recipe240 psArgumentRemove(argNum, config->argc, config->argv);237 char *recipeName = psStringCopy(argv[argNum]); // Name of the recipe 238 psArgumentRemove(argNum, argc, argv); 239 char *recipeSource = psStringCopy(argv[argNum]); // Source of the recipe 240 psArgumentRemove(argNum, argc, argv); 241 241 242 242 if (access(recipeSource, R_OK) == 0) {
Note:
See TracChangeset
for help on using the changeset viewer.
