Exit on EOF
[ctsim.git] / tools / ctsimtext.cpp
index a72edd75cbf6ec6ec6c2cbecca7ce65ca22f00c3..e1695b127f666d8ab34a22ce2e811a1c05b6957a 100644 (file)
@@ -7,9 +7,7 @@
 **   Date Started:  Jan 2001
 **
 **  This is part of the CTSim program
-**  Copyright (C) 1983-2000 Kevin Rosenberg
-**
-**  $Id$
+**  Copyright (C) 1983-2009 Kevin Rosenberg
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
@@ -147,6 +145,10 @@ ctsimtext_main (int argc, char * argv[])
       char* pszInputLine = new char [s_MaxLineLength+1];
       std::cout << szPrompt;
       std::cin.getline (pszInputLine, s_MaxLineLength);
+      if (std::cin.eof()) {
+        std::cout << "\n";
+        break;
+      }
 
 #ifdef DEBUG
       std::cout << "#" << pszInputLine << "#\n";