X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=commandoptionparser.cpp;h=dfad533c8898ff3d79067d5f16c6869803e21e12;hb=bd27c2b0612942815b7417c79f7ee41f669a2a34;hp=3b45e48f4d992e470867a3071ff8d8f18c519dca;hpb=7dab6ac3ae5a5f1ce37dca8cfacaa719881fd5b2;p=mothur.git diff --git a/commandoptionparser.cpp b/commandoptionparser.cpp index 3b45e48..dfad533 100644 --- a/commandoptionparser.cpp +++ b/commandoptionparser.cpp @@ -22,8 +22,12 @@ CommandOptionParser::CommandOptionParser(string input){ optionString = ""; commandString = ""; - if(openParen != -1 && closeParen != -1){ - commandString = input.substr(0, openParen); //commandString contains everything before "(" + if(openParen != -1 && closeParen != -1){ + //gobble extra spaces + int spot = 0; + for (int i = 0; i < input.length(); i++) { if (!(isspace(input[i]))) { spot = i; break; } } + if (spot > openParen) { spot = 0; } + commandString = input.substr(spot, openParen-spot); //commandString contains everything before "(" optionString = input.substr((openParen+1), (closeParen-openParen-1)); //optionString contains everything between "(" and ")". } else if (openParen == -1) { m->mothurOut("[ERROR]: You are missing ("); m->mothurOutEndLine(); }