]> git.donarmstrong.com Git - mothur.git/blobdiff - mothur.cpp
added parse.list command
[mothur.git] / mothur.cpp
index 3bdbfcd0c5e6859a34172c5accf14ebbd28e866a..7acf3894e150f24a8eaaa5bc72f0e752bab4ecc6 100644 (file)
@@ -19,9 +19,11 @@ CommandFactory* CommandFactory::_uniqueInstance = 0;
 int main(int argc, char *argv[]){
        try {
                
-               //remove old logfile
-               string logFileName = "mothur.logFile";
-               remove(logFileName.c_str());
+               string log = "mothur.logFile";
+               remove(log.c_str());
+               
+               time_t ltime = time(NULL); /* calendar time */  
+               string logFileName = "mothur." + toString(ltime) + ".logfile";
                
                //version
                #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
@@ -39,12 +41,16 @@ int main(int argc, char *argv[]){
                        mothurOutJustToLog("Windows version");
                        mothurOutEndLine(); mothurOutEndLine();
                #endif          
-
+               
+               #ifdef USE_READLINE
+                       mothurOutJustToLog("Using ReadLine");
+                       mothurOutEndLine(); mothurOutEndLine();
+               #endif
                
                //header
-               mothurOut("mothur v.1.7.2");
+               mothurOut("mothur v.1.8");
                mothurOutEndLine();             
-               mothurOut("Last updated: 12/04/2009");
+               mothurOut("Last updated: 2/02/2010");
                mothurOutEndLine();     
                mothurOutEndLine();             
                mothurOut("by");
@@ -87,26 +93,34 @@ int main(int argc, char *argv[]){
                        input = argv[1];
 
                        if (input[0] == '#') {
+                               mothurOutJustToLog("Script Mode");
+                               mothurOutEndLine(); mothurOutEndLine();
+
                                mothur = new ScriptEngine(argv[0], argv[1]);
                        }else{
+                               mothurOutJustToLog("Batch Mode");
+                               mothurOutEndLine(); mothurOutEndLine();
+                               
                                mothur = new BatchEngine(argv[0], argv[1]);
                        }
                }
                else{
+                       mothurOutJustToLog("Interactive Mode");
+                       mothurOutEndLine(); mothurOutEndLine();
+                       
                        mothur = new InteractEngine(argv[0]);   
                }
                
-               //used to intercept the terminate signal, so instead of terminating mothur it will end a command
-               //void (*prev_fn)(int);
-               //prev_fn = signal(SIGTERM, mothur->terminateCommand(0));
-               
-               //if (prev_fn==SIG_IGN) signal (SIGTERM,SIG_IGN);
-
-               
                while(bail == 0)                {       bail = mothur->getInput();                      }
+               
+               string outputDir = mothur->getOutputDir();
+               logFileName = outputDir + logFileName;
        
+               //need this because mothur.h makes the logfile, but doesn't know where to put it
+               rename(log.c_str(), logFileName.c_str()); //logfile with timestamp
+               
                delete mothur;
-       
+
                return 0;
        }
        catch(exception& e) {