Adding detection of TTY vs. piped input for interactive mode
authorChristopher L. Conway <christopherleeconway@gmail.com>
Wed, 20 Oct 2010 21:49:10 +0000 (21:49 +0000)
committerChristopher L. Conway <christopherleeconway@gmail.com>
Wed, 20 Oct 2010 21:49:10 +0000 (21:49 +0000)
src/main/main.cpp

index 2f524c3f611ebb4d937a14dce67be6cb4a53858c..fd7c1b303b312009759b33818d22d477a52575da 100644 (file)
  ** Main driver for CVC4 executable.
  **/
 
-#include <iostream>
-#include <fstream>
 #include <cstdlib>
 #include <cstring>
+#include <fstream>
+#include <iostream>
 #include <new>
 
+#include <stdio.h>
+#include <unistd.h>
+
 #include "cvc4autoconfig.h"
 #include "main.h"
 #include "interactive_shell.h"
@@ -125,9 +128,9 @@ int runCvc4(int argc, char* argv[]) {
   // different from the expected behavior of file input from
   // stdin, due to EOL escapes in interactive mode
 
-  // if(!options.interactiveSetByUser) {
-  //   options.interactive = inputFromStdin;
-  // }
+  if(!options.interactiveSetByUser) {
+    options.interactive = inputFromStdin && isatty(fileno(stdin));
+  }
 
   // Create the expression manager
   ExprManager exprMgr(options.earlyTypeChecking);