Changeset 10221 for trunk/FACT++/src


Ignore:
Timestamp:
03/03/11 19:30:44 (14 years ago)
Author:
tbretz
Message:
Added the --dns option and proper environment variable mapping of DIM_DNS_NODE
Location:
trunk/FACT++/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/dclient5.cc

    r10183 r10221  
    466466    const string n = conf.GetName()+".log";
    467467
    468     po::options_description config("Configuration");
     468    po::options_description config("Program options");
    469469    config.add_options()
     470        ("dns",       var<string>("localhost"),  "Dim nameserver host name (Overwites DIM_DNS_NODE environment variable)")
    470471        ("log,l",     var<string>(n), "Write log-file")
    471         ("no-dim,d",  po_switch(), "Disable dim services")
    472         ("console,c", var<int>(),    "Use console (0=shell, 1=simple buffered, X=simple unbuffered)")
     472        ("no-dim,d",  po_switch(),    "Disable dim services")
     473        ("console,c", var<int>(),     "Use console (0=shell, 1=simple buffered, X=simple unbuffered)")
    473474        ;
    474475
    475     conf.AddOptionsCommandline(config);
     476    conf.AddEnv("dns", "DIM_DNS_NODE");
     477
     478    conf.AddOptions(config);
    476479}
    477480
    478481int main(int argc, char* argv[])
    479482{
    480     setenv("DIM_DNS_NODE", "localhost", 0);
    481 
    482483    Configuration conf(argv[0]);
    483484    SetupConfiguration(conf);
     
    503504        return -1;
    504505
     506    // To allow overwriting of DIM_DNS_NODE set 0 to 1
     507    setenv("DIM_DNS_NODE", conf.Get<string>("dns").c_str(), 1);
     508
    505509    try
    506510    {
  • trunk/FACT++/src/test3.cc

    r10183 r10221  
    3636    const string n = conf.GetName()+".log";
    3737
    38     po::options_description config("Configuration");
     38    po::options_description config("Program options");
    3939    config.add_options()
     40        ("dns",       var<string>("localhost"), "Dim nameserver host name (Overwites DIM_DNS_NODE environment variable)")
    4041        ("log,l",     var<string>(n), "Write log-file")
    4142        ("console,c", var<int>(),     "Use console (0=shell, 1=simple buffered, X=simple unbuffered)")
    4243        ;
    4344
    44     conf.AddOptionsCommandline(config);
     45    conf.AddEnv("dns", "DIM_DNS_NODE");
     46
     47    conf.AddOptions(config);
    4548}
    4649
     
    4851{
    4952    cout << "Starting " << argv[0] << "..." << endl;
    50 
    51     // We could use putenv to make the Configure class change the value...
    52     setenv("DIM_DNS_NODE", "localhost", 0);
    5353
    5454    Configuration conf(argv[0]);
     
    7575        return -1;
    7676
     77    // To allow overwriting of DIM_DNS_NODE set 0 to 1
     78    setenv("DIM_DNS_NODE", conf.Get<string>("dns").c_str(), 1);
     79
    7780    if (conf.Get<int>("console")==0)
    7881        RunShell<RemoteShell>(conf);
Note: See TracChangeset for help on using the changeset viewer.