Changeset 1267
- Timestamp:
- 11/15/08 20:26:00 (2 months ago)
- Files:
-
- trunk/pdns/pdns/dynloader.cc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/pdns/pdns/dynloader.cc
r1254 r1267 55 55 56 56 static char pietje[128]="!@@SYSCONFDIR@@:"; 57 arg().set("config-dir","Location of configuration directory (pdns.conf)")=57 ::arg().set("config-dir","Location of configuration directory (pdns.conf)")= 58 58 strcmp(pietje+1,"@@SYSCONFDIR@@:") ? pietje+strlen("@@SYSCONFDIR@@:")+1 : SYSCONFDIR; 59 59 60 arg().set("socket-dir","Where the controlsocket will live")=LOCALSTATEDIR;61 arg().set("remote-address","Remote address to query");62 arg().set("remote-port","Remote port to query")="53000";63 arg().set("secret","Secret needed to connect to remote PowerDNS");60 ::arg().set("socket-dir","Where the controlsocket will live")=LOCALSTATEDIR; 61 ::arg().set("remote-address","Remote address to query"); 62 ::arg().set("remote-port","Remote port to query")="53000"; 63 ::arg().set("secret","Secret needed to connect to remote PowerDNS"); 64 64 65 arg().set("config-name","Name of this virtual configuration - will rename the binary image")="";66 arg().set("chroot","")="";67 arg().setCmd("help","Provide a helpful message");68 arg().laxParse(argc,argv);65 ::arg().set("config-name","Name of this virtual configuration - will rename the binary image")=""; 66 ::arg().set("chroot","")=""; 67 ::arg().setCmd("help","Provide a helpful message"); 68 ::arg().laxParse(argc,argv); 69 69 70 if( arg().mustDo("help")) {70 if(::arg().mustDo("help")) { 71 71 cerr<<"syntax:"<<endl<<endl; 72 cerr<< arg().helpstring(arg()["help"])<<endl;72 cerr<<::arg().helpstring(::arg()["help"])<<endl; 73 73 exit(99); 74 74 } 75 75 76 if( arg()["config-name"]!="")77 s_programname+="-"+ arg()["config-name"];76 if(::arg()["config-name"]!="") 77 s_programname+="-"+::arg()["config-name"]; 78 78 79 string configname= arg()["config-dir"]+"/"+s_programname+".conf";79 string configname=::arg()["config-dir"]+"/"+s_programname+".conf"; 80 80 cleanSlashes(configname); 81 81 82 arg().laxFile(configname.c_str());83 string socketname= arg()["socket-dir"]+"/"+s_programname+".controlsocket";84 if( arg()["chroot"].empty())82 ::arg().laxFile(configname.c_str()); 83 string socketname=::arg()["socket-dir"]+"/"+s_programname+".controlsocket"; 84 if(::arg()["chroot"].empty()) 85 85 localdir="/tmp"; 86 86 else 87 87 localdir=dirname(strdup(socketname.c_str())); 88 88 89 const vector<string>&commands= arg().getCommands();89 const vector<string>&commands=::arg().getCommands(); 90 90 91 91 if(commands.empty()) { … … 97 97 string command=commands[0]; 98 98 shared_ptr<DynMessenger> D; 99 if( arg()["remote-address"].empty())99 if(::arg()["remote-address"].empty()) 100 100 D=shared_ptr<DynMessenger>(new DynMessenger(localdir,socketname)); 101 101 else { 102 102 uint16_t port; 103 103 try { 104 port = lexical_cast<uint16_t>( arg()["remote-port"]);104 port = lexical_cast<uint16_t>(::arg()["remote-port"]); 105 105 } 106 106 catch(...) { 107 cerr<<"Unable to convert '"<< arg()["remote-port"]<<"' to a port number for connecting to remote PowerDNS\n";107 cerr<<"Unable to convert '"<<::arg()["remote-port"]<<"' to a port number for connecting to remote PowerDNS\n"; 108 108 exit(99); 109 109 } 110 110 111 D=shared_ptr<DynMessenger>(new DynMessenger(ComboAddress( arg()["remote-address"], port),arg()["secret"]));111 D=shared_ptr<DynMessenger>(new DynMessenger(ComboAddress(::arg()["remote-address"], port), ::arg()["secret"])); 112 112 } 113 113