fixup! mingw: make isatty() recognize MSys pseudo terminals (/dev/pty*)

This commit is contained in:
Johannes Schindelin
2015-04-22 09:26:24 +01:00
parent 7d57fb4511
commit ce5ca1f9bb
2 changed files with 11 additions and 13 deletions

View File

@@ -7,11 +7,6 @@
#include <wingdi.h>
#include <winreg.h>
#ifdef USE_NTDLL
#include <winternl.h>
#include <ntstatus.h>
#endif
/*
ANSI codes used by git: m, K
@@ -536,9 +531,12 @@ static HANDLE swap_osfhnd(int fd, HANDLE new_handle)
return old_handle;
}
#ifdef USE_NTDLL
#ifdef DETECT_MSYS_TTY
static void msystty_init(int fd)
#include <winternl.h>
#include <ntstatus.h>
static void detect_msys_tty(int fd)
{
ULONG result;
BYTE buffer[1024];
@@ -570,8 +568,6 @@ static void msystty_init(int fd)
_pioinfo(fd)->osflags |= FDEV;
}
#else
#define msystty_init(fd) (void)0
#endif
void winansi_init(void)
@@ -583,10 +579,12 @@ void winansi_init(void)
con1 = is_console(1);
con2 = is_console(2);
if (!con1 && !con2) {
#ifdef DETECT_MSYS_TTY
/* check if stdin / stdout / stderr are msys pty pipes */
msystty_init(0);
msystty_init(1);
msystty_init(2);
detect_msys_tty(0);
detect_msys_tty(1);
detect_msys_tty(2);
#endif
return;
}

View File

@@ -548,7 +548,7 @@ else
BASIC_LDFLAGS += -Wl,--large-address-aware
endif
CC = gcc
COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DUSE_NTDLL
COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY
EXTLIBS += -lntdll
INSTALL = /bin/install
NO_R_TO_GCC_LINKER = YesPlease