Changeset 23259 for trunk/psModules/src/config/pmConfig.c
- Timestamp:
- Mar 10, 2009, 4:53:42 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/config/pmConfig.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/config/pmConfig.c
r23215 r23259 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 … … 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 … … 646 641 psTimeInit(timeName); 647 642 } 643 } 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); 648 665 } 649 666
Note:
See TracChangeset
for help on using the changeset viewer.
