Commit fee92b77 authored by Vitaly Lipatov's avatar Vitaly Lipatov

fix argv filling and comparing

parent b8e17f1f
......@@ -149,15 +149,10 @@ namespace UniSetTypes
int _argc, char** _argv,
const std::string defval="" )
{
for( int i=1; i<_argc; i++ )
for( int i=1; i < (_argc - 1) ; i++ )
{
if( !strcmp(_argv[i], name.c_str()) )
{
int k=i+1;
if( k<_argc )
return _argv[k];
break;
}
if( name == _argv[i] )
return _argv[i+1];
}
return defval;
}
......@@ -171,7 +166,7 @@ namespace UniSetTypes
{
for( int i=1; i<_argc; i++ )
{
if( !strcmp(_argv[i], name.c_str()) )
if( name == _argv[i] )
return i;
}
return -1;
......
......@@ -307,15 +307,12 @@ void Configuration::initConfiguration( int argc, char** argv )
_argc = argc+2*lnodes.size()+2;
_argv = new char*[_argc];
int i = 0;
//
int i=0;
for( ;i<argc; i++ )
{
_argv[i] = new char[strlen(argv[i]) + 1];
strcpy(_argv[i],argv[i]);
}
for( ; i < argc; i++ )
_argv[i] = strdup(argv[i]);
//
// , i
for( UniSetTypes::ListOfNode::iterator it=lnodes.begin(); it!=lnodes.end(); ++it )
{
_argv[i] = "-ORBInitRef";
......@@ -323,8 +320,7 @@ void Configuration::initConfiguration( int argc, char** argv )
string name(oind->getRealNodeName(it->id));
ostringstream param;
param << name << "=corbaname::" << it->host << ":" << it->port;
_argv[i+1] = new char[param.str().size()+1]; // +1 - \0
strcpy(_argv[i+1],param.str().c_str());
_argv[i+1] = strdup(param.str().c_str());
if( unideb.debugging(Debug::INFO) )
unideb[Debug::INFO] << "(Configuration): " << param.str() << endl;
......@@ -355,10 +351,7 @@ void Configuration::initConfiguration( int argc, char** argv )
ostringstream param;
param <<"NameService=corbaname::" << getProp(nsnode,"host") << ":" << defPort;
//
_argv[i+1] = new char[param.str().size()+1]; // +1 - \0
//
strcpy(_argv[i+1],param.str().c_str());
_argv[i+1] = strdup(param.str().c_str());
if( unideb.debugging(Debug::INFO) )
unideb[Debug::INFO] << "(Configuration): " << param.str() << endl;
}
......@@ -771,32 +764,23 @@ xmlNode* Configuration::initDebug( DebugStream& deb, const string& _debname )
string del_level("--"+debname+"-del-levels");
//
for (int i=1; i<_argc; i++)
for (int i=1; i < (_argc - 1); i++)
{
if( !strcmp(_argv[i],log_in.c_str()) ) // "--debug-log_in_file"
if( log_in == _argv[i] ) // "--debug-log_in_file"
{
if( i+1 < _argc )
deb.logFile(_argv[i+1]);
deb.logFile(_argv[i+1]);
}
else if( !strcmp(_argv[i],add_level.c_str()) ) // "--debug-add-levels"
else if( add_level == _argv[i] ) // "--debug-add-levels"
{
if( i+1 < _argc )
{
string val(_argv[i+1]);
deb.addLevel(Debug::value(val));
}
deb.addLevel(Debug::value(_argv[i+1]));
}
else if( !strcmp(_argv[i],del_level.c_str()) ) // "--debug-del-levels"
else if( del_level == _argv[i] ) // "--debug-del-levels"
{
if( i+1 < _argc )
{
string val(_argv[i+1]);
deb.delLevel(Debug::value(val));
}
deb.delLevel(Debug::value(_argv[i+1]));
}
}
return dnode;
return dnode;
}
// -------------------------------------------------------------------------
void Configuration::initRepSections()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment