Skip to content
Snippets Groups Projects
Commit c686b931 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

basic stuff working

parent cf4e41ed
No related branches found
No related tags found
No related merge requests found
...@@ -1033,11 +1033,11 @@ void GetOptions(int argc, char *argv[]) ...@@ -1033,11 +1033,11 @@ void GetOptions(int argc, char *argv[])
else else
Msg::Fatal("Missing number"); Msg::Fatal("Missing number");
} }
#if defined(HAVE_FLTK)
else if(!strcmp(argv[i] + 1, "term")) { else if(!strcmp(argv[i] + 1, "term")) {
terminal = 1; terminal = 1;
i++; i++;
} }
#if defined(HAVE_FLTK)
else if(!strcmp(argv[i] + 1, "dual")) { else if(!strcmp(argv[i] + 1, "dual")) {
CTX::instance()->mesh.dual = 1; CTX::instance()->mesh.dual = 1;
i++; i++;
......
...@@ -47,18 +47,24 @@ static void splitOptionName(const std::string &fullName, std::string &category, ...@@ -47,18 +47,24 @@ static void splitOptionName(const std::string &fullName, std::string &category,
std::string &name, int &index) std::string &name, int &index)
{ {
std::string::size_type d = fullName.find_first_of('.'); std::string::size_type d = fullName.find_first_of('.');
if(d == std::string::npos){
name = fullName;
return;
}
category = fullName.substr(0, d); category = fullName.substr(0, d);
std::string::size_type b1 = fullName.find_first_of('['); std::string::size_type b1 = fullName.find_first_of('[');
std::string::size_type b2 = fullName.find_last_of(']'); std::string::size_type b2 = fullName.find_last_of(']');
if(b1 != std::string::npos && b2 != std::string::npos){ if(b1 != std::string::npos && b2 != std::string::npos){
std::string id = fullName.substr(b1, b2 - b1); std::string id = fullName.substr(b1 + 1, b2 - b1 - 1);
name = fullName.substr(d, b1 - d); index = atoi(id.c_str());
category = fullName.substr(0, b1);
name = fullName.substr(d + 1, b1 - d);
} }
else{ else{
index = 0; index = 0;
name = fullName.substr(d); name = fullName.substr(d + 1);
} }
Msg::Debug("Decoded option name '%s' . '%s' '[%d]'", category.c_str(), Msg::Debug("Decoded option name '%s' . '%s' (index %d)", category.c_str(),
name.c_str(), index); name.c_str(), index);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment