- Timestamp:
- Mar 17, 2009, 12:07:42 PM (17 years ago)
- Location:
- branches/cnb_branches/cnb_branch_20090301/psModules
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
src/config/pmConfig.c (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/cnb_branches/cnb_branch_20090301/psModules
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/cnb_branches/cnb_branch_20090215/psModules merged eligible /trunk/psModules merged eligible /branches/cnb_branch_20090215/psModules 21495-22685 /branches/eam_branches/eam_branch_20090303/psModules 23158-23228
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
branches/cnb_branches/cnb_branch_20090301/psModules/src/config/pmConfig.c
r21314 r23351 13 13 14 14 #include <stdio.h> 15 #include <stdlib.h> 15 16 #include <string.h> 16 17 #include <strings.h> /* for strn?casecmp */ … … 24 25 #include <pslib.h> 25 26 26 #include "pmConfig.h"27 27 #include "pmErrorCodes.h" 28 28 #include "pmFPALevel.h" 29 29 #include "pmConfigRecipes.h" 30 30 #include "pmConfigCamera.h" 31 #include "pmConfigRun.h" 32 33 #include "pmConfig.h" 31 34 32 35 #ifdef HAVE_NEBCLIENT … … 142 145 config->format = NULL; 143 146 config->formatName = NULL; 144 config->recipes = psMetadataAlloc();147 config->recipes = NULL; 145 148 config->recipesRead = PM_RECIPE_SOURCE_NONE; 146 149 config->recipesCamera = psMetadataAlloc(); … … 432 435 // variable will contain the name of the configuration file. 433 436 434 char *configFile = NULL; 435 // 437 char *configFile = NULL; // Name of configuration file 438 436 439 // First, try command line 437 //438 440 psS32 argNum = psArgumentGet(*argc, argv, "-ipprc"); 439 441 if (argNum != 0) { … … 447 449 } 448 450 } 449 // 451 450 452 // Next, try environment variable 451 //452 453 if (!configFile) { 453 454 configFile = getenv(IPPRC_ENV); 454 455 if (configFile) { 455 configFile = psStringCopy (configFile); 456 } 457 } 458 459 // 456 configFile = psStringCopy(configFile); 457 } 458 } 459 460 460 // Last chance is ~/.ipprc 461 //462 461 if (!configFile) { 463 462 char *home = getenv("HOME"); … … 466 465 } 467 466 468 // We have the configuration filename; now we read and parse the config 469 // file and store in psMetadata struct user. 467 // Read and parse the config file and store in struct user. 470 468 // XXX move this section to pmConfigReadUser.c ? 471 472 469 if (!pmConfigFileRead(&config->user, configFile, "user")) { 473 470 psFree(config); … … 477 474 psFree(configFile); 478 475 479 // XXX why was this being called here? Is someone calling pmConfigRead multiple times? 480 // pmConfigDone(); 481 assert (configPath == NULL); 476 pmConfigRunCommand(config, *argc, argv); 482 477 483 478 // define the config-file search path (configPath). 479 psAssert(configPath == NULL, "Configuration path is already defined."); 484 480 psString path = psMetadataLookupStr(NULL, config->user, "PATH"); 485 pmConfigSet (path);481 pmConfigSet(path); 486 482 487 483 // read the SITE file … … 525 521 psLogSetLevel(logLevel); 526 522 } 527 528 523 529 524 // Set logging format … … 648 643 } 649 644 645 // Set the random number generator seed 646 { 647 psU64 seed = 0; // RNG seed 648 int argNum = psArgumentGet(*argc, argv, "-seed"); // Argument number 649 if (argNum > 0) { 650 psArgumentRemove(argNum, argc, argv); 651 if (argNum >= *argc) { 652 psWarning("-seed command-line switch provided without the required seed value --- ignored."); 653 } else { 654 char *end = NULL; // Pointer to end of consumed string 655 seed = strtoll(argv[argNum], &end, 0); 656 if (strlen(end) > 0) { 657 psError(PS_ERR_IO, true, "Unable to read random number generator seed: %s", argv[argNum]); 658 psFree(config); 659 return NULL; 660 } 661 psArgumentRemove(argNum, argc, argv); 662 } 663 } 664 pmConfigRunSeed(config, seed); 665 } 666 650 667 // Next, we do a similar thing for the camera configuration file. The 651 668 // file is read and parsed into psMetadata struct "camera". … … 1110 1127 // camera. If we are discovering the camera (config->camera == NULL), then we also load the 1111 1128 // recipe files for the camera. 1112 psMetadata *pmConfigCameraFormatFromHeader(psMetadata **camera, psString *cameraName, psString *formatName, 1113 pmConfig *config, const psMetadata *header, bool readRecipes)1129 psMetadata *pmConfigCameraFormatFromHeader(psMetadata **camera, psString *cameraName, psString *formatName, 1130 pmConfig *config, const psMetadata *header, bool readRecipes) 1114 1131 { 1115 1132 PS_ASSERT_PTR_NON_NULL(config, NULL); … … 1672 1689 // if the object does not exist and create isn't set, then we 1673 1690 // should puke 1674 psError(PM_ERR_SYS, true, "Unable to access file %s ", filename);1691 psError(PM_ERR_SYS, true, "Unable to access file %s: %s", filename, nebErr(server)); 1675 1692 nebServerFree(server); 1676 1693 return NULL; … … 1685 1702 if (trunc) { 1686 1703 if(truncate(path, 0) != 0) { 1687 psError(PS_ERR_IO, true, "Failed to truncate Nebulous file %s (real name %s)\n", filename, path); 1704 psError(PS_ERR_IO, true, "Failed to truncate Nebulous file %s (real name %s)\n", 1705 filename, path); 1688 1706 return NULL; 1689 1707 }
Note:
See TracChangeset
for help on using the changeset viewer.
