No args default w/ tty stdout, not tty stdin #220

This commit is contained in:
Nicolas Williams committed 2014-06-16 22:34:50 -05:00
1 parent ea0ffe24f8
commit ea63d5d3c2
2 files changed
+15

No files matched your search

+3
View File
@@ -79,6 +79,9 @@ EOF
AM_CONDITIONAL([ENABLE_DOCS], [test "x$enable_docs" != xno]) AM_CONDITIONAL([ENABLE_DOCS], [test "x$enable_docs" != xno])
AC_FIND_FUNC([isatty], [c], [#include <unistd.h>], [0])
AC_FIND_FUNC([_isatty], [c], [#include <io.h>], [0])
AC_ARG_ENABLE([pthread-tls], AC_ARG_ENABLE([pthread-tls],
[AC_HELP_STRING([--enable-pthread-tls], [AC_HELP_STRING([--enable-pthread-tls],
[Enable use of pthread thread local storage])], [Enable use of pthread thread local storage])],
+12
View File
@@ -237,6 +237,18 @@ int main(int argc, char* argv[]) {
die(); die();
} }
} }
#if (!defined(WIN32) && defined(HAVE_ISATTY)) || defined(HAVE__ISATTY)
#if defined(HAVE__ISATTY) && defined(isatty)
#undef isatty
#define isatty _isatty
#endif
if (!program && isatty(STDOUT_FILENO) && !isatty(STDIN_FILENO))
program = ".";
#endif
if (!program) usage(); if (!program) usage();
if (ninput_files == 0) current_input = stdin; if (ninput_files == 0) current_input = stdin;