Changeset 11086
- Timestamp:
- Jan 12, 2007, 4:28:16 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/regtoolConfig.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/regtoolConfig.c
r11047 r11086 30 30 // this function can not fail -- exits on error 31 31 pxConfig *p0toolConfig(pxConfig *config, int argc, char **argv) { 32 33 psExit exit_status = PS_EXIT_SUCCESS; 34 32 35 if (!config) { 33 36 config = pxConfigAlloc(); … … 37 40 config->modules = pmConfigRead(&argc, argv, NULL); 38 41 if (!config->modules) { 39 psError(P S_ERR_UNKNOWN, false, "Can't find site configuration");42 psError(PXTOOLS_ERR_CONFIG, false, "Can't find site configuration"); 40 43 goto FAIL; 41 44 } … … 211 214 psArgumentRemove (N, &argc, argv); \ 212 215 if (config->mode) { \ 213 psError(P S_ERR_UNKNOWN, true, "only one mode selection is allowed"); \216 psError(PXTOOLS_ERR_CONFIG, true, "only one mode selection is allowed"); \ 214 217 goto FAIL; \ 215 218 } \ … … 218 221 } \ 219 222 if (!psMetadataAddMetadata(argSets, PS_LIST_TAIL, option, 0, NULL, argset)) {;\ 220 psError(P S_ERR_UNKNOWN, false, "failed to add argset for %s", option);\223 psError(PXTOOLS_ERR_PROG, false, "failed to add argset for %s", option);\ 221 224 } \ 222 225 psFree(argset); \ … … 236 239 bool argErr = false; 237 240 if (config->mode == P0TOOL_MODE_NONE) { 241 psError(PXTOOLS_ERR_CONFIG, false, "missing mode argument"); 242 fprintf (stderr, "mode argument is required\n"); 238 243 argErr = true; 239 fprintf (stderr, "mode argument is required\n");240 244 } else if (! psArgumentParse(config->args, &argc, argv) || argc != 1) { 245 psError(PXTOOLS_ERR_CONFIG, false, "unknown argument"); 246 fprintf (stderr, "error parsing arguments\n"); 241 247 argErr = true; 242 fprintf (stderr, "error parsing arguments\n");243 248 } 244 249 … … 272 277 if ((str = psMetadataLookupStr(&status, config->args, "-" #name))) { \ 273 278 if (!psMetadataAddStr(config->where, PS_LIST_TAIL, #name, 0, "==", str)) {\ 274 psError(P S_ERR_UNKNOWN, false, "failed to add item " #name); \279 psError(PXTOOLS_ERR_PROG, false, "failed to add item " #name); \ 275 280 goto FAIL; \ 276 281 } \ … … 288 293 if ((str = psMetadataLookupStr(&status, config->args, "-inst"))) { 289 294 if (!psMetadataAddStr(config->where, PS_LIST_TAIL, "camera", 0, "==", str)) { 290 psError(P S_ERR_UNKNOWN, false, "failed to add item camera");295 psError(PXTOOLS_ERR_PROG, false, "failed to add item camera"); 291 296 goto FAIL; 292 297 } … … 300 305 if ((imfiles = psMetadataLookupS32(&status, config->args, "-imfiles"))) { 301 306 if (!psMetadataAddS32(config->where, PS_LIST_TAIL, "imfiles", 0, "==", imfiles)) { 302 psError(P S_ERR_UNKNOWN, false, "failed to add item imfiles");307 psError(PXTOOLS_ERR_PROG, false, "failed to add item imfiles"); 303 308 goto FAIL; 304 309 } … … 318 323 config->dbh = pmConfigDB(config->modules); 319 324 if (!config->dbh) { 320 psError(P S_ERR_UNKNOWN, false, "Can't configure database");325 psError(PXTOOLS_ERR_SYS, false, "Can't configure database"); 321 326 goto FAIL; 322 327 } … … 330 335 331 336 FAIL: 337 // use the top-most error to determine the exit status 338 exit_status = pxerrorGetExitStatus(); 339 332 340 psFree(config); 333 341 pmConfigDone(); 334 342 psLibFinalize(); 335 exit( EXIT_FAILURE);343 exit(exit_status); 336 344 }
Note:
See TracChangeset
for help on using the changeset viewer.
