]> git.donarmstrong.com Git - mothur.git/blobdiff - mothur.cpp
added logfile feature
[mothur.git] / mothur.cpp
index 5142ca22eabb2d6a3121e6dc2701cb4a04fe9f1f..0314331287f0de7c466dc5cb4aacedece62fd56a 100644 (file)
@@ -11,7 +11,7 @@
 #include "engine.hpp"
 #include "globaldata.hpp"
 
-using namespace std;
+/**************************************************************************************************/
 
 GlobalData* GlobalData::_uniqueInstance = 0;
 
@@ -20,29 +20,34 @@ int main(int argc, char *argv[]){
                //srand(54321);
                srand( (unsigned)time( NULL ) );
 
-               Engine* dotur;
+               Engine* mothur;
                bool bail = 0;
+               string input;
 
                if(argc>1){
-                       dotur = new BatchEngine(argv[1]);
+                       input = argv[1];
+
+                       if (input[0] == '#') {
+                               mothur = new ScriptEngine(argv[0], argv[1]);
+                       }else{
+                               mothur = new BatchEngine(argv[0], argv[1]);
+                       }
                }
                else{
-                       dotur = new InteractEngine();           
+                       mothur = new InteractEngine(argv[0]);           
                }
 
-               while(bail == 0)                {       bail = dotur->getInput();                       }
+               while(bail == 0)                {       bail = mothur->getInput();                      }
        
-               delete dotur;
+               delete mothur;
        
                return 0;
        }
        catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the dotur class Function main. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the dotur class function main. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               errorOut(e, "mothur", "main");
                exit(1);
        }
 }
 
+/**************************************************************************************************/
+