]> git.donarmstrong.com Git - mothur.git/blobdiff - engine.cpp
removed line option
[mothur.git] / engine.cpp
index 55617bc3f80a97e1832ff61c3e09678de8eca1ca..0a0f5a0ce7f0f4f0a120509e2c3d5c0e51471ecb 100644 (file)
@@ -21,7 +21,7 @@ InteractEngine::InteractEngine(string path){
        globaldata = GlobalData::getInstance();
        globaldata->argv = path;
        
-       system("clear");
+       
 }
 
 /***********************************************************************/
@@ -86,14 +86,6 @@ BatchEngine::BatchEngine(string path, string batchFileName){
                openedBatch = openInputFile(batchFileName, inputBatchFile);
                globaldata->argv = path;
                                
-               system("clear");
-       
-       //      char buffer = ' ';
-       //      ifstream header("introtext.txt");
-       //      while(!header.eof()){
-       //              cout << buffer;
-       //              buffer = header.get();
-       //      }
        }
        catch(exception& e) {
                errorOut(e, "BatchEngine", "BatchEngine");
@@ -127,9 +119,7 @@ bool BatchEngine::getInput(){
                while(quitCommandCalled == 0){
        
                        if (inputBatchFile.eof()) { input = "quit()"; }
-                       else { getline(inputBatchFile, input); }
-                       
-                       
+                       else { input = getline(inputBatchFile); }
                        
                        if (input[0] != '#') {
                                
@@ -182,7 +172,7 @@ ScriptEngine::ScriptEngine(string path, string commandString){
 
                globaldata->argv = path;
                
-               system("clear");
+               
        
        }
        catch(exception& e) {
@@ -252,13 +242,21 @@ bool ScriptEngine::getInput(){
 string ScriptEngine::getNextCommand(string& commandString) {
        try {
                string nextcommand = "";
+               int count = 0;
                
-               nextcommand = commandString.substr(0,commandString.find_first_of(';'));
-
+               //go through string until you reach ; or end
+               while (count < commandString.length()) { 
+                       
+                       if (commandString[count] == ';') {  break;   }
+                       else {          nextcommand += commandString[count];    }
+                       
+                       count++;
+               }
+               
+               //if you are not at the end
+               if (count != commandString.length())  {   commandString = commandString.substr(count+1, commandString.length());  }
+               else { commandString = ""; }
                                
-               if ((commandString.find_first_of(';')+1) <= commandString.length()) {
-                       commandString = commandString.substr(commandString.find_first_of(';')+1, commandString.length());
-               }else { commandString = ""; } //you have reached the last command.
                
                //get rid of spaces in between commands if any
                if (commandString.length() > 0) {