#include "engine.hpp"
-/***********************************************************************/
-inline void terminateCommand(int dummy) {
-
- //mothurOut("Stopping command....");
- //CommandFactory* cFactory = CommandFactory::getInstance();
- //cFactory->getCommand(); //deletes old command and makes new no command.
- //this may cause memory leak if old commands execute function allocated memory
- //that is freed in the execute function and not the deconstructor
- //mothurOut("DONE."); mothurOutEndLine();
-}
/***********************************************************************/
Engine::Engine(){
try {
#ifdef USE_READLINE
char* nextCommand = NULL;
nextCommand = readline("mothur > ");
- if(nextCommand != NULL) { add_history(nextCommand); }
+
+ if(nextCommand != NULL) { add_history(nextCommand); }
+ else{ //^D causes null string and we want it to quit mothur
+ nextCommand = "quit";
+ cout << nextCommand << endl;
+ }
+
mothurOutJustToLog("mothur > " + toString(nextCommand));
return nextCommand;
#else
string nextCommand = "";
mothurOut("mothur > ");
getline(cin, nextCommand);
+ mothurOutJustToLog("mothur > " + toString(nextCommand));
return nextCommand;
#endif
#else
string nextCommand = "";
mothurOut("mothur > ");
getline(cin, nextCommand);
+ mothurOutJustToLog("mothur > " + toString(nextCommand));
return nextCommand;
#endif