X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;ds=sidebyside;f=mothur.cpp;fp=mothur.cpp;h=b551302646c10b813740516eaa65cc46453b4a1d;hb=836150c0a3666899ad58426388f4999d6cf8829a;hp=67ede87039d783c71a40a0317d3a1ccbffdc7b97;hpb=39a0a86958038d71083fad3a1a50c02ba9c2fc67;p=mothur.git diff --git a/mothur.cpp b/mothur.cpp index 67ede87..b551302 100644 --- a/mothur.cpp +++ b/mothur.cpp @@ -78,13 +78,14 @@ int main(int argc, char *argv[]){ m->setVersion(mothurVersion); //will make the gui output "pretty" - bool guiMode = false; + bool outputHeader = true; if (argc>1) { string guiInput = argv[1]; - if (guiInput[0] == '+') { guiMode = true; } + if (guiInput[0] == '+') { outputHeader = false; } + if (guiInput[0] == '-') { outputHeader = false; } } - if (!guiMode) { + if (outputHeader) { //version #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) #if defined (__APPLE__) || (__MACH__) @@ -161,7 +162,7 @@ int main(int argc, char *argv[]){ //srand(54321); srand( (unsigned)time( NULL ) ); - Engine* mothur; + Engine* mothur = NULL; bool bail = 0; string input; @@ -177,6 +178,12 @@ int main(int argc, char *argv[]){ }else if (input[0] == '+') { mothur = new ScriptEngine(argv[0], argv[1]); m->gui = true; + }else if (input == "-version") { + m->mothurOut("Mothur version=" + mothurVersion + "\nRelease Date=" + releaseDate); m->mothurOutEndLine(); m->mothurOutEndLine(); m->closeLog(); + #ifdef USE_MPI + MPI_Finalize(); + #endif + return 0; }else{ m->mothurOutJustToLog("Batch Mode"); m->mothurOutEndLine(); m->mothurOutEndLine(); @@ -229,7 +236,7 @@ int main(int argc, char *argv[]){ } - delete mothur; + if (mothur != NULL) { delete mothur; } #ifdef USE_MPI MPI_Finalize();