]> git.donarmstrong.com Git - mothur.git/blobdiff - commandoptionparser.cpp
working on pam
[mothur.git] / commandoptionparser.cpp
index 3b45e48f4d992e470867a3071ff8d8f18c519dca..0038a714f4ae356e11d7dea57b4840a81eb946f4 100644 (file)
@@ -22,12 +22,16 @@ 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(); }
-               else if (closeParen == -1) { m->mothurOut("[ERROR]:You are missing )"); m->mothurOutEndLine(); }
+               else if (closeParen == -1) { m->mothurOut("[ERROR]: You are missing )"); m->mothurOutEndLine(); }
     }
        catch(exception& e) {
                m->errorOut(e, "CommandOptionParser", "CommandOptionParser");