Exit on EOF
authorKevin M. Rosenberg <kevin@rosenberg.net>
Wed, 21 Mar 2018 21:20:28 +0000 (15:20 -0600)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Wed, 21 Mar 2018 21:20:28 +0000 (15:20 -0600)
tools/ctsimtext.cpp

index 5a569c4d70b74429829826746587cd5e9375219c..e1695b127f666d8ab34a22ce2e811a1c05b6957a 100644 (file)
@@ -145,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";